Created
December 31, 2019 07:14
-
-
Save inspirit941/05f48121398b7e5f6f35daf53ac01529 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
answer = 0 | |
for _ in range(n): | |
# 각 단어별로 확인하기 | |
string = list(input()) | |
# 첫 글자는 table에 바로 저장 | |
prev = string.pop(0) | |
table = set(prev) | |
# 그룹 단어인지 체크하는 Bool | |
is_group = True | |
for word in string: | |
# 단어가 이미 table에 존재할 경우 | |
if word in table: | |
# 같지 않다는 건, 연속된 글자가 끝난 뒤 다시 글자가 등장했다는 의미 | |
if word != prev: | |
is_group = False | |
break | |
# table에 단어 저장 | |
table.add(word) | |
prev = word | |
if is_group: | |
answer += 1 | |
print(answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment