

If the string is “abcd”, then all possible substrings of size two are { “ab”, “bc”, “cd”}.
The first line contains a single integer ‘T’ representing the number of test cases.
The next ‘T’ lines contain a string 'STR' which denotes the input string.
For each test case, return all different substrings of size two that appear in 'STR' as contiguous substrings.
Output for every test case will be printed in a separate line.
You don’t need to print anything; It has already been taken care of.
1 <= T <= 5*10^3
2 <= |STR| <= 10^3
Time limit: 1 sec
The basic idea is to iterate through the ‘STR’ and store all the substrings of size 2 in a HashSet and finally return the size of this HashSet.