123456789101112131415161718192021222324
#include <iostream> #include <string> #include <regex> using namespace std; int main() { regex re("[A-F]?A+F+C+[A-F]?"); int t; cin >> t; cin.ignore(255, '\n'); while(t--) { string line; getline(cin, line); if (regex_match(line, re)) cout << "Infected\n"; else cout << "Good" << '\n'; } }