관리 메뉴

솜씨좋은장씨

[BaekJoon] 5358번 : Football Team (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 5358번 : Football Team (Python)

솜씨좋은장씨 2022. 12. 20. 21:37
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Football Team 입니다.

 

5358번: Football Team

Print the same list of names with every ‘i’ replaced with an ‘e’, every ‘e’ replaced with an ‘i’, every ‘I’ replaced with an ‘E’, and every ‘E’ replaced with an ‘I’.

www.acmicpc.net

👨🏻‍💻 코드 ( Solution )

def football_team(name):
    change_word_dict = {"e": "i", "i": "e", "E": "I", "I": "E"}
    
    new_name_list = [change_word_dict[word] if word in change_word_dict else word for word in list(name)]
    
    return "".join(new_name_list)


if __name__ == "__main__":
    while True:
        try:
            name = input()
            print(football_team(name=name))
        except EOFError:
            break
 

GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07

1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.

github.com

Comments