Programming/Python & Data Structures
[Baekjoon/Python3] 1475번 방 번호
HooNeee
2020. 12. 3. 00:56
[Baekjoon/Python3] 1475번 방 번호
1475번: 방 번호
첫째 줄에 다솜이의 방 번호 N이 주어진다. N은 1,000,000보다 작거나 같은 자연수 또는 0이다.
www.acmicpc.net
import math
from math import ceil
n = str(input())
n = n.replace('9', '6')
cnt = []
for i in n:
if i == str(6):
cnt.append(ceil(n.count(i) / 2))
else:
cnt.append(n.count(i))
print(max(cnt))