pattern match code.

http://www.geeksforgeeks.org/flipkart-interview-set-4-sde-1/
trie implementation