본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 4606번 The Seven Percent Solution

by 현장 2023. 4. 26.

-Code

dic = {" ": "%20", "!": "%21", "$": "%24", "%": "%25",
       "(": "%28", ")": "%29", "*": "%2a"}

while 1:
    s = input()

    if s == "#":
        break

    res = ""

    for w in s:
        if w in dic:
            res += dic[w]
        else:
            res += w
    print(res)