Marks :20
: 3 | : 0
Given a binary string $$$S$$$, find the number of subsequences of length 5 which are palindromes.
A palindrome is a string that reads the same backward as forward, for example strings "z","aaa","aba","abccba" are palindromes, but strings "algouniversity","reality","ab" are not.
The first line of input contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of testcases. The description of $$$t$$$ testcases follows.
The first and only line of each testcase contains a binary string $$$S$$$ $$$(1 \le |S| \le 10^5)$$$.
It is guaranteed that the sum of $$$|S|$$$ over all testcases does not exceed $$$10^5$$$.
For each test case, print a single integer — the number of subsequences of $$$S$$$ length 5 which are palindromes. As the answer can be rather large, print it modulo $$$10^9 + 7$$$.
3010011011100100
5 0 1
In sample test case 1, following are the palindromic subsequences of length 5:
In sample test case 2, subsequences of length 5 are not possible. Hence the output is 0.
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.