This problem is in Contest(s) below:
Contest 1502:Trie及Ac自动机入门