#include #include #include #include int main() { std::string start, end; long long n; std::cin >> start >> n >> end; int scoin = std::count(start.begin(), start.end(), 'o'), // 最初のコインの枚数 ecoin = std::count(end.begin(), end.end(), 'o'); // 最後のコインの枚数 // コインの数が最初と最後で違う if (scoin != ecoin) { std::cout << "SUCCESS" << std::endl; return 0; } /****************************************** 以下は最初と最後のコインの枚数が同じ *******************************************/ // コインの枚数が3枚か0枚ならばどうやってもあり得る状態になる if (scoin == 3 || scoin == 0 || n >= 2) { std::cout << "FAILURE" << std::endl; return 0; } int s = -1, e = -1; if (start[0] != end[0])s = 0; if (start[1] != end[1]) { if (s != -1)e = 1; else s = 1; } if (start[2] != end[2])e = 2; if (s == -1)s = e = 0; if (n == 1) { if (e - s <= 1) std::cout << "FAILURE" << std::endl; else std::cout << "SUCCESS" << std::endl; return 0; } if (n == 0){ if(e - s == 0)std::cout << "FAILUER" << std::endl; else std::cout << "SUCCESS" << std::endl; } return 0; }