Design a data structure that supports the following two operations:
1 2 |
|
search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can represent any one letter.
For example:
1 2 3 4 5 6 7 |
|
Note:
You may assume that all words are consist of lowercase letters a-z.