112. Word Pattern
EasyHash MapBijection
Print YES if the words follow the pattern: there is a one-to-one mapping between pattern letters and words.
Input format
Line 1: pattern Line 2: words separated by spaces
Output format
YES or NO
Example 1
Input
abba dog cat cat dog
Output
YES
Example 2
Input
abba dog cat cat fish
Output
NO
Constraints
1 ≤ |pattern| ≤ 300
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…