Skip to content

Baekjoon 2386

1. Problem

문제 확인하기

2. Solution

while 42:
    t = input()
    if t == '#':
        break
    lst = t.split()
    alpha_upper = lst[0].upper()
    alpha_lower = lst[0].lower()
    s = " ".join(lst[1:])
    cnt = s.count(alpha_upper) + s.count(alpha_lower)
    print("{0} {1}".format(alpha_lower, cnt))