[BaekJoon] 9093번: 단어 뒤집기 (Python)
Solution
import sys
from typing import List
def solution(strs: List[str]) -> List[str]:
answer = []
for s in strs:
tmp_list = s.split()
tmp_s = ''
for w in tmp_list:
tmp_s += w[::-1] + ' '
answer.append(tmp_s.rstrip())
return answer
T = int(sys.stdin.readline().rstrip())
array = []
for _ in range(T):
array.append(sys.stdin.readline().rstrip())
print(*solution(array), sep='\n')
Leave a comment