-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1316.cpp
More file actions
54 lines (36 loc) · 996 Bytes
/
1316.cpp
File metadata and controls
54 lines (36 loc) · 996 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<iostream>
using namespace std;
bool wordCheck(string str) {
bool alphabet[26] = { false };
//알파벳에 해당하는 위치를 index 0~25에 맞게 할당하기 위해
for (int i = 0; i < str.length(); i++) {
if (alphabet[str[i] - 'a']) { //true 이면 이미 있었으므로 false
return false;
}
else { //false 이면 처음 오는 알파벳 이므로 check
char tmp = str[i];
alphabet[str[i] - 'a'] = true;
while (true) {
if (tmp != str[++i]) {
i--;
break;
}
}
}
}
return true;
}
int main(void) {
int n;
cin >> n;
int count = 0;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
if (wordCheck(str)) {
count++;
}
}
cout << count;
return 0;
}