ricky3853   2년 전

import sys


croatia = {'c=': 0, 'c-': 0, 'dz=': 0, 'd-': 0, 'lj': 0, 'nj': 0, 's=': 0, 'z=': 0}

old_str = sys.stdin.readline().rstrip()

new_str = ''
count_croatia, count_left = 0,0

for key in croatia:
    if key in old_str:
       new_str = old_str.replace(key,' '*len(key))
       croatia[key] =  (len(old_str.replace(' ','')) - len(new_str.replace(' ',''))) // len(key)

       count_left = len(new_str.replace(' ',''))
       old_str = new_str




print(sum(croatia.values())+count_left)

tempnixk   2년 전

반례

입력: =

출력: 0

정답: 1

댓글을 작성하려면 로그인해야 합니다.