A string is a palindrome when reading it backwards gives the same string. For example "a", "aa", "appa" and "queryreuq" are all palindromes.
You start with an empty string S and process two kinds of operations.
- Append one lowercase letter to the end of S.
- Delete the last character of S.
After each operation, count the palindromic substrings of the current string. For a string S and integers i, j with 1≤i≤j≤∣S∣, let S[i,j] be the substring of S that runs from its i-th character to its j-th character. Count the pairs (i,j) for which S[i,j] is a palindrome, and print that count.