You are given a pattern string of lowercase letters and a sentence of lowercase words separated by single spaces. Decide whether there is a bijection (a one-to-one correspondence) between the distinct pattern letters and the distinct words such that replacing each letter of the pattern with its matched word reproduces the sentence exactly.
Concretely, this holds when the pattern and the sentence have the same length and, for all positions i and j, pattern[i] == pattern[j] if and only if word[i] == word[j].
Print YES if such a bijection exists, otherwise print NO.
Input format
Line 1: the pattern string (lowercase letters, no spaces).
Line 2: the sentence (space-separated lowercase words).
Output format
One line: YES or NO.
Constraints
- 1 <= length of pattern <= 2000
- The sentence has between 1 and 2000 words; each word has length 1 to 20 (
a-z).