Skip to content

Commit e982fb8

Browse files
committed
Create 1702B-PolycarpWritesAStringFromMemory.cpp
1 parent f4d2b93 commit e982fb8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream>
2+
#include <set>
3+
4+
int main(){
5+
6+
long t; std::cin >> t;
7+
while(t--){
8+
std::string s; std::cin >> s;
9+
long cnt(0); std::set<long> w;
10+
for(long p = 0; p < s.size(); p++){
11+
w.insert(s[p]);
12+
if(w.size() > 3){
13+
++cnt;
14+
w.clear();
15+
w.insert(s[p]);
16+
}
17+
}
18+
19+
cnt += (w.size() > 0);
20+
std::cout << cnt << std::endl;
21+
}
22+
23+
}

0 commit comments

Comments
 (0)