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 | #include <iostream> #include <string> using namespace std; int main(void) { int N, answer = 0; bool isUsed[26]; cin >> N; string input; for(int i=0; i<N; i++) { cin >> input; bool isGroup = true; for(int j=0; j<26; j++) isUsed[j] = false; for(int j=0; j<input.length(); j++) { if(isUsed[input.at(j) - 'a']) { isGroup = false; break; } else { isUsed[input.at(j) - 'a'] = true; while((j+1 < input.length())) { if(input.at(j) == input.at(j+1)) j++; else break; } } } if(isGroup) { answer++; } } cout << answer << endl; return 0; } | cs |
'C & C++ > Baekjoon' 카테고리의 다른 글
백준 1924 - 2007년 (0) | 2017.12.27 |
---|---|
백준 1546 - 평균 (0) | 2017.12.27 |
백준 1157 - 단어 공부 (0) | 2017.12.27 |
백준 1152 - 단어의 개수 (0) | 2017.12.27 |
백준 1110 - 더하기 사이클 (0) | 2017.12.27 |