BQJ 백준/python

[Python/파이썬] 백준 1316번: 그룹 단어 체커

아류시 2024. 6. 11. 13:47
반응형


문제 설명

https://www.acmicpc.net/problem/1316

 

 

 

제출한 코드

num = int(input())
total = 0

for i in range(num) :
    word = input()
    j = 0
    while j<len(word):
        if word.count('*', j,len(word))>0 :
            break
        a = word.count(word[j])
        word = word.replace(word[j],'*')
        if a>1 :
            j += a-1
        if j==len(word)-1 :
            total+=1
        j+= 1

print(total)

 

 

 

 

결과

 

 

후기

 

 

 

 



반응형