You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
928 B
33 lines
928 B
input = "3113322113"
|
|
#input = "21"
|
|
|
|
loop = 0
|
|
while loop < 50:
|
|
index = 0
|
|
new_input = ""
|
|
#print("Input: " + input)
|
|
while index != len(input):
|
|
#print("\t Index: " + str(index))
|
|
char_count = 1
|
|
char = input[index]
|
|
#print("\t Char: " + char)
|
|
for i in range(index+1, len(input)):
|
|
#print("\t\t I: " + str(i))
|
|
#print("\t\t Input[i]:" + input[i])
|
|
if input[i] == char:
|
|
char_count += 1
|
|
#print("\t\t\tMatch found")
|
|
else:
|
|
#print("\t\t\tBreak")
|
|
break;
|
|
#print("\t Char Count: " + str(char_count))
|
|
#print("\t There is " + str(char_count) + " number " + char)
|
|
new_input += str(char_count)
|
|
new_input += str(char)
|
|
index += char_count
|
|
#print("New Input: " + new_input)
|
|
input = new_input
|
|
loop += 1
|
|
|
|
#print(input)
|
|
print(len(input))
|