본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 12085번 Moist (Small1)

by 현장 2024. 7. 12.

-Code

for t in range(1, int(input()) + 1):
    n = int(input())
    names = [input() for _ in range(n)]
    res, now = 0, names[0]
    for i in range(1, n):
        if now > names[i]:
            res += 1
            continue
        now = names[i]
    print(f"Case #{t}: {res}")