Palindromes in a Tree

CodeForces - 914E