Given a string S consisting of uppercase alphabetic characters. Return the number of different substrings of size 2 that appear in S as contiguous substrings.
The first line contains 'T' denoting the number of testcases. Then follows description of test cases. The next T lines contains the string S.
Output the number of different substrings of size 2 in S.
Explanation: For "ABCAB", the three distinct substrings of size 2 are "AB", "BC" and "CA". For "XYZ", the two distinct substrings of size 2 are "XY" and "YZ".
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.