 All Problems
Word Pattern
easy
strings
hash map
google
amazon
microsoft
dropbox

Given a pattern and a string s (space-separated words), return true if s follows the same pattern (bijection between letters and words).

Example 1:

Input: abba
       dog cat cat dog
Output: true

Example 2:

Input: abba
       dog cat cat fish
Output: false

Input format: Line 1 = pattern, line 2 = words.

Run to check your code against the sample cases, or submit to run every case