s = input()
result = ""
for c in s:
if c.islower():
result += chr((ord(c)-97 + 13) % 26 + 97)
elif c.isupper():
result += chr((ord(c)-65 + 13) % 26 + 65)
else:
result += c
print(result)
https://www.acmicpc.net/problem/11655
11655번: ROT13
첫째 줄에 알파벳 대문자, 소문자, 공백, 숫자로만 이루어진 문자열 S가 주어진다. S의 길이는 100을 넘지 않는다.
www.acmicpc.net
'알고리즘 > 백준-파이썬' 카테고리의 다른 글
[백준] 11656번 (python 파이썬) (0) | 2022.04.11 |
---|---|
[백준] 10824번 (python 파이썬) (0) | 2022.04.11 |
[백준] 2743번 (python 파이썬) (0) | 2022.04.09 |
[백준] 10820번 (python 파이썬) (0) | 2022.04.09 |
[백준] 10809번 (python 파이썬) (0) | 2022.04.09 |