[BOJ 9056] Letter Bank
View as PDFA letter bank is a word such that all the letters of one letter bank can be used as many times as desired (at least once each) to make a new word. For example, ‘IMPS’ is a bank of ‘MISSISSIPPI.’</p>
Given two words α and β, you are to write a program for deciding whether α is a bank of β. Assume that the first word α has no repeated letters. Every word consists only of capital Roman letters: A, B, …, Z, and no blank.
입력 형식
Your program is to read from standard input. The input consists of T (1 ≤ T ≤ 20) test cases. The number T of test case is given in the first line of the input. For each test case, two words are given in one line. There is a single space between the first word and the second word. And each word has length at most 80.
출력 형식
Your program is to write a standard output. Print exactly one line for each test case. For each test case, print “YES” if the first word is a bank of the second word. Otherwise, print “NO”.
예제 입력
4
IMPS MISSISSIPPI
BLUE BLUE
CNT COCONUT
IPC PC
예제 출력
YES
YES
NO
NO
Comments