Input: s = "dszepvaxuo", k = 3
Output: {{1, 's'}, {6, 'a'}, {8, 'u'}}
Explanation: Moving each character 3 steps gives:
'd' -> 'g', 'g' is not present in s
's' -> 'v', 'v' is present in s, thus, indices array becomes{{1, 's'}}
'z' -> 'c', 'c' is not present in s
'e' -> 'h', 'h' is not present in s
'p' -> 's', 's' is present in s, but is already present in indices array
'v' -> 'y', 'y' is not present in s
'a' -> 'd', 'd' is present in s, thus, indices array becomes {{1, 's'}. {6, 'a'}}
'x' -> 'a', 'a' is present in s, but is already present in indices array
'u' -> 'x', 'x' is present in s, thus, indices array becomes {{1, 's'}, {6, 'a'}, {8, 'u'}}
'o' -> 'r', 'r' is not present in s
Thus, final indices array is {{1, 's'}, {6, 'a'}, {8, 'u'}}
Input: s = "abcdefg", k = 2
Output: {{0, 'a'}, {1, 'b'}, {4, 'e'}}
Below is the implementation of the above approach.