-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patha.cpp
33 lines (30 loc) · 855 Bytes
/
a.cpp
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
#include <bits/stdc++.h>
#define endl '\n'
#define eat cin
#define moo cout
#define int long long
using namespace std;
string a, b, c;
int32_t main(){
eat.tie(0) -> sync_with_stdio(0);
eat >> a >> b >> c;
bool ok[2] = {0, 0};
for(int t = 0; t < 2; t++){
for(int i = 0; i < (int)a.size(); i++){
if(a.substr(i, b.size()) == b){
for(int j = i+b.size(); j < (int)a.size(); j++){
if(a.substr(j, c.size()) == c){
ok[t] = true;
break;
}
}
break;
}
}
reverse(a.begin(), a.end());
}
if(ok[0] && ok[1]) moo << "both" << endl;
else if(ok[0]) moo << "forward" << endl;
else if(ok[1]) moo << "backward" << endl;
else moo << "fantasy" << endl;
}