You are given a string S. Suppose a character ‘c’ occurs consecutively X times in the string. Replace these consecutive occurrences of the character ‘c’ with (X, c) in string. give me i/P code example
Example: You are given a string S. Suppose a character ‘c’ occurs consecutively X times in the string. Replace these consecutive occurrences of the character ‘c’ with (X, c) in string
(1, 1) (3, 2) (1, 3) (2, 1)