• + 0 comments

    Well you can also use trie Data Structure Just in case if the input is very big. But in this question the input set is very small so you can just use simple code.