[백준] 1316 그룹 단어 체커

김은서·2021년 12월 8일
0

백준

목록 보기
37/48

Python code

T = int(input())
for tc in range(1, T+1):
    N = int(input())
    cnt = 0
    for i in range(N):
        word = input()
        use = []
        flag = 1
        for i in range(len(word)):
            if word[i] not in use:
                use.append(word[i])
            else:
                if word[i] == word[i-1]:
                    pass
                else:
                    flag = 0
        if flag == 1:
            cnt += 1
    print(cnt)
profile
Gracelog

0개의 댓글