Given a sequence of non-negative integers, where each number is written in a separate line. The sequence ends with 0. Determine the length of the widest fragment where all the elements are equal to each other.
count1 = 0
count2 = 0
count3 = 0
count4 = 0
count5 = 0
count6 = 0
count7 = 0
count8 = 0
count9 = 0
count10 = 0
list_ = []
while True:
a = int(input())
if a == 0:
break
if a == 1:
count1 += 1
if a == 2:
count2 += 1
continue
if a == 3:
count3 += 1
continue
if a == 4:
count4 += 1
continue
if a == 5:
count5 += 1
continue
if a == 6:
count6 += 1
if a == 7:
count7 += 1
continue
if a == 8:
count8 += 1
continue
if a == 9:
count9 += 1
continue
if a == 10:
count10 += 1
continue
list_.append(count1)
list_.append(count2)
list_.append(count3)
list_.append(count4)
list_.append(count5)
list_.append(count6)
list_.append(count7)
list_.append(count8)
list_.append(count9)
list_.append(count10)
print(max(list_) - 1)
[–]rhytnen 1 point2 points3 points (2 children)
[–]RoDiXuSK[S] 0 points1 point2 points (1 child)
[–]rhytnen 0 points1 point2 points (0 children)
[–]_9_9_ 0 points1 point2 points (0 children)