Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int T[1001], k = 0;
- for (int i = 0; i < n; ++i){
- cin.get();
- char v[6];
- cin.get(v, 6);
- bool one[3];
- bool two[3];
- bool three[5];
- for (int i = 0; i <= 2; ++i){
- one[i] = false;
- two[i] = false;
- }
- for (int i = 0; i <= 4; ++i)
- three[i] = false;
- for (int i = 0; v[i]; ++i)
- {
- if (v[i] == 'o'){
- one[0] = true;
- two[2] = true;
- }
- else
- if (v[i] == 'n')
- one[1] = true;
- else
- if (v[i] == 'e'){
- one[2] = true;
- three[3] = true;
- three[4] = true;
- }
- else
- if (v[i] == 't'){
- two[0] = true;
- three[0] = true;
- }
- else
- if (v[i] == 'w')
- two[1] = true;
- else
- if (v[i] == 'h')
- three[1] = true;
- else
- if (v[i] == 'r')
- three[2] = true;
- }
- int cnt = 0;
- if (strlen(v) == 3){
- for (int i = 0; i <= 2; ++i)
- if (one[i]) cnt++;
- if (cnt >= 2)
- T[++k] = 1;
- else {
- cnt = 0;
- for (int i = 0; i <= 2; ++i)
- if (two[i]) cnt++;
- if (cnt >= 2)
- T[++k] = 2;
- }
- }
- else
- if (strlen(v) == 5){
- cnt = 0;
- for (int i = 0; i <= 4; ++i)
- if (three[i]) cnt++;
- if (cnt >= 4)
- T[++k] = 3;
- }
- }
- for (int i = 1; i <= k; ++i) {
- cout << T[i];
- if (i != k) cout << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement