Pablo had been trying to convince Gaviria to reduce his punishments by making some deals. This time Gaviria gives him a chance to do so. He gives Pablo a problem to solve. If he solves the problem he will be set free.
Gaviria is pretty confident that Pablo will not be able to solve the problem but Pablo being rich hired the best problem solver (You) to solve the problem.
The statement is -
Given a string S, A Substring of S is said to be SPECIAL if either of the following properties is satisfied
Find the number of SPECIAL Substrings of S.
Help Pablo to solve the problem.
INPUT
OUTPUT
CONSTRAINTS
For 1st test case S='aba'.
Substrings of S are : a, ab, aba, b, ba, a
Out of these only 'ab' and 'ba' satisfies the condition for SPECIAL Substring.
So the answer is 2.