백준 9056번: Letter Bank #Python

ColorlessDia·2025년 10월 12일

algorithm/baekjoon

목록 보기
693/807
import sys

input = sys.stdin.readline

T = int(input())

for _ in range(T):
    A, B = input().rstrip().split()

    char_count = dict()

    for b in B:

        if b not in char_count:
            char_count[b] = 0

        char_count[b] += 1

    C = ''.join(sorted(A))
    D = ''.join(sorted(char_count.keys()))

    if C == D:
        print('YES')
    else:
        print('NO')

0개의 댓글