BOJ - 5218 - 알파벳 거리
Updated:
import sys
def solution():
T = int(input())
for i in range(1, T+1):
A, B = map(str, sys.stdin.readline().split())
ret = []
for j in range(len(A)):
value = ord(B[j]) - ord(A[j])
if value < 0: ret.append(26 + value)
else: ret.append(value)
string = ''
for k in ret:
string += str(k) + ' '
print("Distances: {}".format(string))
solution()
https://www.acmicpc.net/problem/5218
Leave a comment