#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 <= 2; i++) { if (s1[i] == 'o') { n1++; } if (s2[i] == 'o') { n2++; } } if (n1 != n2) { cout << "SUCCESS" << endl; return 0; } bool ret = false; if (n == 0) { if (s1 != s2) { ret = true; } } else if (n == 1 && n1 > 0 && n2 > 0) { char c = n1 == 1 ? 'o' : 'x'; int idx1 = 0, idx2 = 0; for (int i = 0; i < 2; i++) { if (s1[i] == c) { idx1 = i; } if (s2[i] == c) { idx2 = i; } } if (abs(idx1 - idx2) <= n) { ret = true; } } cout << (ret ? "SUCCESS" : "FAILURE") << endl; return 0; }