This is the code i have for the above problem
practice : Big Data
I have submitted following code
from itertools import groupby def compress(s): sg = groupby(s) rets= "" for i, g in sg: lens = len(list(g)) if lens > 1: rets += str(lens) + i else: rets += i return rets def get_score(s): score = 0 for i in s: if i.isdigit(): score += 32 else: score += 8 return score for _ in range(int(input())) : ins = input() com = compress(ins) #print(com) print(len(ins) * 8 - get_score(com))
Can someone please tell me why it is failng.
Thanks in advance.