Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- void del(vector<string> &v, string aim, vector<string> &other) {
- for(int i = 0; i < v.size(); i++) {
- if(v[i].find(" " + aim + " ") != string::npos || v[i].find(" " + aim) != string::npos || v[i].find(aim + " ") != string::npos) {
- other.push_back(v[i]);
- v.erase(v.begin() + i);
- i--;
- }
- }
- }
- bool cmp(string a, string b) {
- return a.size() < b.size();
- }
- main() {
- int n;
- cin >> n;
- vector<string> v(n), other;
- getchar();
- for(int i = 0; i < n; i++) {
- getline(cin, v[i]);
- }
- string aim;
- cin >> aim;
- del(v, aim, other);
- cout << "Sort by(inter number):\n1)Phrase length\n2)Aplphabet\n";
- int id;
- cin >> id;
- if(id == 1) {
- sort(v.begin(), v.end(), cmp);
- sort(other.begin(), other.end(), cmp);
- } else {
- sort(v.begin(), v.end());
- sort(other.begin(), other.end());
- }
- cout << "First\n";
- for(auto it: v) {
- cout << it << endl;
- }
- cout << "Second\n";
- for(auto it: other) {
- cout << it << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement