-Code
encryption = {}
for i in range(1, 53):
if i <= 26:
alpa = chr(ord("a") + i - 1)
encryption[alpa] = str(i).zfill(2)
else:
alpa = chr(ord("A") + i - 27)
encryption[alpa] = str(i)
line = input()
res = ""
for word in line:
if word.isdigit():
res += "#" + word
elif word.isalpha():
res += encryption[word]
else:
res += word
print(res)
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 14322번 Country Leader (Small) (0) | 2024.01.13 |
---|---|
[백준/파이썬] 18884번 New Year and Naming (0) | 2024.01.12 |
[백준/파이썬] 12184번 GBus count (Small) (1) | 2024.01.10 |
[백준/파이썬] 26751번 Najmniejsza liczba (1) | 2024.01.09 |
[백준/파이썬] 8270번 Tulips (0) | 2024.01.08 |