#include <iostream>
#include <memory.h>
using namespace std;
int cnt = 0;
bool flag = true;
void check(string s) {
for (int i = 0; i < s.length() - 2; i++) {
if (s[i] != s[i + 1]) { //1๊ณผ 2์ ๋จ์ด๊ฐ ๋ค๋ฅผ๋
for (int k = i + 2; k < s.length(); k++) { //3๋ถํฐ ๋๊น์ง ์ฒดํฌํด 1๊ณผ ๊ฐ์ ๋จ์ด๊ฐ ์๋์ง ์ฒดํฌ
if (s[i] == s[k]) {
flag = false;
}
}
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N; cin >> N;
int ans = 0;
while (N--) {
string s; cin >> s;
if (s.length() == 1) ans++; //๋จ์ด๊ฐ ํ๊ธ์๋ผ๋ฉด ๊ทธ๋ฃน๋จ์ด์ด๋ค.
else { //๋จ์ด๊ฐ ํ๊ธ์๊ฐ ์๋๋ผ๋ฉด
check(s); //ํ์ํ๋ค
if (flag) ans++;
flag = true;
}
}
cout << ans;
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 13239๋ฒ - Combinations (0) | 2021.11.04 |
---|---|
[๋ฐฑ์ค,c++] 13171๋ฒ - A (0) | 2021.11.04 |
[๋ฐฑ์ค,c++] 13163๋ฒ - ๋๋ค์์ ๊ฐ ๋ถ์ด๊ธฐ (0) | 2021.11.04 |
[๋ฐฑ์ค,c++] 13023๋ฒ - ABCDE (0) | 2021.11.04 |
[๋ฐฑ์ค,c++] 1302๋ฒ - ๋ฒ ์คํธ์ ๋ฌ (0) | 2021.11.04 |
[๋ฐฑ์ค,c++] 1292๋ฒ - ์ฝ๊ฒ ํธ๋ ๋ฌธ์ (0) | 2021.11.04 |
๋๊ธ