func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double PI = 4 * atan(1);   const int32_t MOD = 1e9 + 7;   int power(int x, unsigned int y) {     int temp;     if (y == 0) return 1;     temp = power(x, y / 2);     if (y % 2 == 0)       return temp * temp % MOD;     else       return x * temp % MOD * temp % MOD;   }   void solve() {     string s;     cin >> s;     int n = s.length();     string s1, s2;     cin >> s1 >> s2;     int m1 = s1.length(), m2 = s2.length();     int j = -1, k = -1;     bool f1 = 0, f2 = 0;     j = s.find(s1);     k = s.find(s2, s1.length() + j);     if (j != -1 && k != -1) f1 = 1;     reverse(s.begin(), s.end());     j = -1, k = -1;     j = s.find(s1);     k = s.find(s2, s1.length() + j);     if (j != -1 && k != -1) f2 = 1;     if (f1 && f2)       cout <<  both n ;     else if (f1)       cout <<  forward n ;     else if (f2)       cout <<  backward n ;     else       cout <<  fantasy n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(0);     solve();     return 0;   }   