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)
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)
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
from itertools import *
for i,j in groupby(map(int,list(raw_input()))):
print(tuple([len(list(j)), i]) ,end = " ")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us