'''
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
'''
with open('hw3a.txt') as newfile:
x = [line.strip() for line in newfile]
def majority_item(x):
counter = 0
box = {}
for item in x:
if box[item] == {}:
box[item] = 1
if box == {item}:
box[item] += 1
else:
box = {}
box[item] = 1
for item in x:
box[item] -= 1
if counter == 0:
box = {}
print(majority_item(x))
332313
765216
618002
8
309476
812518
919441
727774
509704
782733
360408
125312
646967
81989
8
29
612432
8
85308
655115
609811
353512
158737
400338
798485
29577
950047
947594
125312
535876
508506
330334
502168
85681
817811
718872
91478
323057
341255
37
448316
674456
37
212015
238595
37
385109
755245
351413
8
72649
551082
316289
37
29
684053
29
421733
313431
148395
53893
621085
8
415428
430769
623502
273362
835374
37317
148057
37
908991
660218
8
403751
575234
917922
721633
764542
467104
684323
469466
848965
108878
262071
32331
8
253458
37
598449
43717
363856
5264
979549
158921
954325
916761
29
41
896254