Timus 2058 Using Palindromic Tree or Eertree
How can we solve this problem by Palindromic Tree aka Eertree?