Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("verbal_tics.in");
- ofstream fout("verbal_tics.out");
- #define NMAX 515
- char line[NMAX], sep[] = "./?,;:'@#!- ";
- vector <string> vs;
- vector <pair <string, string>> :: iterator it;
- pair <string, string> ps;
- vector < pair <string, string> > ans;
- int main()
- {
- while (fin.getline(line, NMAX))
- {
- char *p = strtok(line, sep);
- while (p)
- {
- vs.push_back(p);
- p = strtok(NULL, sep);
- }
- }
- for (int i = 0; i < (int)vs.size() - 2; i++)
- {
- ps.first = vs[i];
- ps.second = vs[i + 1];
- if (ps.first.size() < 3 or ps.second.size() < 3)
- continue;
- for (int j = i + 1; j < (int)vs.size() - 1; j++)
- if (ps.first == vs[j] && ps.second == vs[j + 1])
- {
- it = find(ans.begin(), ans.end(), ps);
- if (it == ans.end())
- {
- ans.push_back(make_pair(ps.first, ps.second));
- }
- }
- }
- for (int i = 0; i < (int)ans.size(); i++)
- fout << ans[i].first << ' ' << ans[i].second << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement