SWEA (SW Expert Academy)/D3

[SWEA/D3] 7272 안경이 없어!

hellosonic 2023. 5. 18. 15:13

문제 바로가기

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

나의 코드 및 설명

t = int(input())

for test_case in range(1, t+1):
    a,b = input().split()

    a_list = list(map(str, str(a)))
    b_list = list(map(str, str(b)))

    no_hole = ["C","E","F","G","H","I","J","K","L","M","N","S","T","U","V","W","X","Y","Z"]
    yes_hole = ["A","D","O","P","Q","R"]

    check_a = ""
    check_b = ""
    for i in range(len(a_list)):
        if a_list[i] in no_hole:
            check_a += "C"
        elif a_list[i] in yes_hole:
            check_a += "A"
        else:
            check_a += "B"

    for i in range(len(b_list)):
        if b_list[i] in no_hole:
            check_b += "C"
        elif b_list[i] in yes_hole:
            check_b += "A"
        else:
            check_b += "B"

    if check_a == check_b:
        print("#{} {}".format(test_case, "SAME"))
    else:
        print("#{} {}".format(test_case, "DIFF"))