Each army fighting the world war Z is denoted with a word consisting any combination of…
- User
Each army fighting the world war Z is denoted with a word consisting any combination of 26 alphabets. An army is a match for his/her opponent if and only if his name is an anagram of his/her opponent. Your job as a programmer is to help find whether two randomly selected members are match for each other or not.
(An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase, using all the original letters exactly once. Your task is to find whether a given pair of words is anagrams to each other. Eg: Silent is anagram to listen.) Input: Number of test cases (t ≤ 10). Each test case consists of a pair of strings (length of string ≤ 1000) separated by a single space.
Output: For each test case, print ‘Yes’ if they are a match to each other and ‘No’ otherwise.
SAMPLE INPUT 2 listen silent mancap pacmaan
SAMPLE OUTPUT Yes No
Assistant
pythont = int(input()) for _ in range(t): a, b = input().split() if len(a) != len(b): print("No") else: print("Yes" if sorted(a.lower()) == sorted(b.lower()) else "No")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.