You are given a pattern of letters and a string s of words separated by single spaces.
The sentence follows the pattern when each letter of the pattern stands for one word, and each word stands for one letter. So the same letter always means the same word, and two different letters never mean the same word.
Return true if s follows pattern. Otherwise return false.
Examples
Example 1:
Input: pattern = "abab", s = "chai tea chai tea"
Output: true
Explanation: a is "chai" and b is "tea" each time.
Example 2:
Input: pattern = "ab", s = "tea tea"
Output: false
Explanation: Two different letters would stand for the same word.
Example 3:
Input: pattern = "abc", s = "red green blue"
Output: true
Explanation: Every letter has its own word.