
Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings words .
For example, if words = ["abc", "xyz"] and the stream added the four characters (one by one) 'a' , 'x' , 'y' , and 'z' , your algorithm should detect that the suffix "xyz" of the characters "axyz" matches "xyz" from words .
Implement the StreamChecker class:
StreamChecker(String[] words) Initializes the object with the strings array words .
boolean query(char letter) Accepts a new character from the stream and returns true if any non-empty suffix from the stream forms a word that is in words .
1 <= words.length <= 20001 <= words[i].length <= 200words[i] consists of lowercase English letters.letter is a lowercase English letter.At most 4 * 10 ^4 calls will be made to query.