Given a string s, the task is to count number of subsequences of the form aibjck, where i >= 1, j >=1 and k >= 1.
Note: Two subsequences are considered different if the set of array indexes picked for the 2 subsequences are different.
Input : abbc Output : 3 Subsequences are abc, abc and abbc Input : abcabc Output : 7 Subsequences are abc, abc, abbc, aabc abcc, abc and abc
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains a string s.
For each test case in a new line print the required output.
1<=Length of string <=100
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.