-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1141.cpp
More file actions
37 lines (29 loc) · 689 Bytes
/
1141.cpp
File metadata and controls
37 lines (29 loc) · 689 Bytes
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
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int N;
cin >> N;
vector<string> v(N);
vector<bool> check(N, true);
for(int i = 0; i < N; i++){
cin >> v[i];
}
sort(v.begin(), v.end());
for(int i = 0; i < v.size(); i++){
for(int j = i+1; j < v.size(); j++){
if(v[j].substr(0, v[i].size()) == v[i]){
check[i] = false;
break;
}
}
}
int cnt = 0;
for(auto elem : check)
if(elem) cnt++;
cout << cnt << '\n';
return 0;
}