#include #include #include using namespace std; int main() { long long n; string s1, s2; cin >> s1 >> n >> s2; int n1 = 0, n2 = 0; for (int i = 0; i < s1.size(); i++) { if (s1[i] == 'o') { n1++; } if (s2[i] == 'o') { n2++; } } if (n1 != n2) { cout << "SUCCESS" << endl; return 0; } int n_o = n1; if (n_o == 0 || n_o == 3) { cout << "FAILURE" << endl; return 0; } char c = n_o == 1 ? 'o' : 'x'; int idx1 = 0, idx2 = 0; for (int i = 0; i < s1.size(); i++) { if (s1[i] == c) { idx1 = i; } if (s2[i] == c) { idx2 = i; } } if ((long long)abs(idx1 - idx2) > n) { cout << "SUCCESS" << endl; } else { cout << "FAILURE" << endl; } return 0; }