{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003cp\u003e The problem is very simple. For every string given as input, you need to tell us the number of subsequences of it that are palindromes (need not necessarily be distinct). Note that the empty string is not a palindrome. \r\n\r\nFor example, the palindromic subsequences of \"aab\" are:\r\n\"a\", \"a\", \"b\", \"aa\", and the method returns 4.\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003e\r\nFirst line contains the number of test cases T (atmost 20). Each of the next T lines contains a single string whose number of palindromic subsequences are to be printed. The maximum length of any input string is 50.\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003e\r\nFor each test case, print in a single line, the number of palindromic subsequences of the input string.\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\r\n\u003cpre\u003e\r\n\u003cb\u003eInput:\u003c/b\u003e\r\n3\r\naab\r\ndddd\r\nthisisapalindromeemordnilapasisiht\r\n\u003cb\u003eOutput:\u003c/b\u003e\r\n4\r\n15\r\n814157\r\n\u003c/pre\u003e\r\n"}}]}