본문 바로가기

알고리즘/백준-파이썬

[백준] 11655번 (python 파이썬)

 

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