3dop
#include <iostream> #include <cctype> #include <cstring> #include <iomanip> #include <cmath> using namespace std; void Function(char *s, int len) { int count = 0; for (int i = 0; i < len; i++) { if ((char)tolower(s[i]) == 'a' and s[i+1] == '1' and (char)tolower(s[i+2])=='c') { count++; i+=2; } } if (count >= 2) { for (int i = 0; i < len; i++) { if (isupper(s[i])) cout<<(char)tolower(s[i]); else cout<<s[i]; } cout<<endl; } } int main() { int n; cin >> n; cin.ignore(); char s[51]; for (int i = 0; i < n; i++) { cin.getline(s, 50); int len = strlen(s); Function(s, len); } }
Leave a Comment