#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i)) #define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i)) #if defined(_MSC_VER)||__cplusplus > 199711L #define AUTO(r,v) auto r = (v) #else #define AUTO(r,v) typeof(v) r = (v) #endif #define ALL(c) (c).begin() , (c).end() #define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it) #define LL long long #define int LL #define INF 99999999 #define DEV 1000000007 #define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0); using namespace std; int dx[4] = { -1.1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 }; int S[1600], T[1600], Y[1600], M[1600]; int N, C, V; int str, str2; int n; signed main() { QUICK_CIN; //ifstream cin("debug.txt"); //ofstream cout("result.txt"); string a; cin >> a; vector it; for (int i = 0; i < a.length();++i){ if (a[i] == 'o'){ it.push_back(i); } } cin >> n; cin >> a; vector it2; for (int i = 0; i < a.length(); ++i){ if (a[i] == 'o'){ it2.push_back(i); } } if (it.size() != it2.size()){ cout << "SUCCESS" << endl; return 0; } if (it.size() == 1){ int sa = abs(it[0] - it2[0]); if (sa > n){ cout << "SUCCESS" << endl; return 0; } if (it[0] == 1 && !sa && n == 1){ cout << "SUCCESS" << endl; return 0; } } if (it.size() == 2){ int sa = abs((3 - it[0] - it[1]) - (3- it2[0] - it2[1])); if (sa > n){ cout << "SUCCESS" << endl; return 0; } if ((3 - it[0] - it[1])== 1 && !sa && n == 1){ cout << "SUCCESS" << endl; return 0; } } cout << "FAILURE" << endl; return 0; }