Skip to content

Baekjoon 2495

1. Problem

문제 확인하기

2. Solution

1. Python (memory: 31256KB, time: 40ms)

for _ in range(3):
    num = input()
    arr = [num[0]]
    answer = [1]
    cnt = 1
    for i in range(1, 8):
        if arr[-1] == num[i]:
            cnt += 1
        else:
            arr.append(num[i])
            answer.append(cnt)
            cnt = 1
    answer.append(cnt)
    print(max(answer))