-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathc657.py
More file actions
39 lines (36 loc) · 924 Bytes
/
c657.py
File metadata and controls
39 lines (36 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# while True:
# try:
# a = input()
# count = 0
# max_count = 0
# max_char = ''
# front = a[0]
# for i in a:
# if front != i:
# count = 1
# else:
# count += 1
# if count > max_count:
# max_count = count
# max_char = i
# front = i
# print(max_char, max_count)
# except:
# break
while True:
try:
x = input() + '1'
count = 1
maximum = 0
maximumalphabet = ''
for i in range(len(x) - 1):
if x[i] == x[i+1]:
count += 1
else:
if maximum < count:
maximum = count
maximumalphabet = x[i]
count = 1
print(maximumalphabet, maximum)
except:
break