-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1316.cpp
executable file
·60 lines (57 loc) · 1.09 KB
/
1316.cpp
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
55
56
57
58
59
60
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<stdexcept>
#include<memory>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<numeric>
using namespace std;
bool is_sequence(string::iterator p){
string::iterator next = p;
++next;
if(*p == *next){ return true;}
return false;
}
int main(){
int n;
cin >> n;
cin.ignore();
set<char> characters;
int count = 0;
while(n>0){
string line;
getline(cin,line);
auto p = line.begin();
characters.insert(*p);
while(p!=line.end()){
if(is_sequence(p)){
if(find(characters.begin(),characters.end(),*p)==characters.end()){
characters.insert(*p);
}
++p;
}
else{
string::iterator next = p;
++next;
if(find(characters.begin(),characters.end(),*next)!=characters.end()){
--n;
break;
}
else{
characters.insert(*next);
++p;
}
}
}
if(p==line.end()){
count += 1;
--n;
}
}
cout << count << '\n';
}