백준 1316번 - Silver V
#include <iostream>
#include <algorithm> // abs() 포함되어있음
#include <vector>
#include <string>
using namespace std;
int cnt;
void check(string x){
int sz = x.size();
for(int i=0;i<sz-2;i++){
if(x[i]!=x[i+1]){
for(int j = i+2;j<sz;j++){
if(x[j]==x[i]){
return;
}
}
}
}
cnt++;
}
int main(void) {
int n;
cin>>n;
string str;
for(int i=0;i<n;i++){
cin>>str;
check(str);
}
cout << cnt<<endl;
return 0;
}'코딩 > C++' 카테고리의 다른 글
| 백준 문제풀이 C++ [220225] - 기본 수학 1단계 (0) | 2022.02.25 |
|---|---|
| 백준 문제풀이 C++ [220223] - if문 (0) | 2022.02.23 |
| 백준 문제풀이 C++ [220119] - 문자열 (0) | 2022.01.19 |
| 백준 문제풀이 C++ [220116] - 문자열 (0) | 2022.01.16 |
| [C++] :: String - c++의 문자열 라이브러리 (0) | 2022.01.13 |