Please enter your email address or userHandle.
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".
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.