-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path63.cpp
More file actions
42 lines (38 loc) · 812 Bytes
/
63.cpp
File metadata and controls
42 lines (38 loc) · 812 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
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
bool check(string s,string t)
{
return s.size()<t.size();
}
int main() {
// #ifdef _DEBUG
// freopen("input.txt", "r", stdin);
// // freopen("output.txt", "w", stdout);
// #endif
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; ++i)
cin >> s[i];
sort(s.begin(), s.end(), [&] (const string &s, const string &t) {
return s.size() < t.size();
});
for (auto it : s)
cout << it << endl;
cout<<s[2].find("aba")<<"\n";
cout<<string::npos<<"\n";
for (int i = 0; i < n - 1; ++i) {
if (s[i + 1].find(s[i]) == string::npos) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
for (auto it : s)
cout << it << endl;
return 0;
}