Algorithm/Baekjoon
[백준] 1475 : 방 번호 - Python
Dev.sohee
2020. 7. 6. 14:40
https://www.acmicpc.net/problem/1475
1475번: 방 번호
첫째 줄에 다솜이의 방 번호 N이 주어진다. N은 1,000,000보다 작거나 같은 자연수 또는 0이다.
www.acmicpc.net
import sys
N = str(sys.stdin.readline())
N = N.replace('9', '6')
res = 0
for i in range(9):
cnt = N.count(str(i))
if i == 6:
cnt = (cnt // 2 + cnt % 2)
if res < cnt:
res = cnt
print(res)