-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboj1316.py
28 lines (25 loc) · 885 Bytes
/
boj1316.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
num = int(input())
cnt = 0
for i in range(num):
words = input()
bow = []
if len(words) == 1:
cnt += 1
else:
for j in range(len(words)):
if j == 0:
bow.append(words[0])
elif j > 0:
if words[j] == words[j-1]:
bow.append(words[j])
if j == len(words)-1:
cnt += 1
elif words[j] != words[j-1]: # j번째 철자가 앞의 철자와 다를 때
if words[j] not in bow:
if j == len(words)-1:
cnt += 1
else:
bow.append(words[j])
elif words[j] in bow: # j번째 철자가 앞에서 등장했다면 중단
break
print(cnt)