The problem 514C - Watto and Mechanism I used a trie to store and search for the strings. My solution was accepted 9841544.There is a bug in my implementation of the trie and my code shouldn't be accepted because it fails test cases like this one.
1 1
aaabaac
aaaa
my code produces "YES", but the correct answer is "NO".