Language: C++

int main() {
	string s;
	cin >> s;
	//cout << s.substr(1, 1) << endl;
	if (s[0] != 'A') {
		cout << "WA" << endl;
		return 0;
	}
	int n = s.size() - 1;

	string sub = s.substr(1, n - 1);
	//cout << sub.c_str() << endl;
	int cnt = 0;
	if (sub.size() < 2) {
		cout << "WA" << endl;
		return 0;
	}
	for (int i = 1; i < sub.size()-1; i++) {
		if (sub[i] == 'C')cnt++;
	}

	if (sub[0] == 'C' || sub[sub.size()-1] == 'C') {
		cout << "WA" << endl;
		return 0;
	}
	if (cnt != 1) {
		cout << "WA" << endl;
		return 0;
	}

	for (int i = 1; i < s.size(); i++) {
		if ('a' > s[i] || s[i] > 'z') {
			if (s[i] != 'C') {
				cout << "WA" << endl;
				return 0;
			}
		}
	}
	cout << "AC" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'string' was not declared in this scope
    2 |         string s;
      |         ^~~~~~
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> s;
      |         ^~~
a.cc:3:16: error: 's' was not declared in this scope
    3 |         cin >> s;
      |                ^
a.cc:6:17: error: 'cout' was not declared in this scope
    6 |                 cout << "WA" << endl;
      |                 ^~~~
a.cc:6:33: error: 'endl' was not declared in this scope
    6 |                 cout << "WA" << endl;
      |                                 ^~~~
a.cc:11:15: error: expected ';' before 'sub'
   11 |         string sub = s.substr(1, n - 1);
      |               ^~~~
      |               ;
a.cc:14:13: error: 'sub' was not declared in this scope
   14 |         if (sub.size() < 2) {
      |             ^~~
a.cc:15:17: error: 'cout' was not declared in this scope
   15 |                 cout << "WA" << endl;
      |                 ^~~~
a.cc:15:33: error: 'endl' was not declared in this scope
   15 |                 cout << "WA" << endl;
      |                                 ^~~~
a.cc:18:29: error: 'sub' was not declared in this scope
   18 |         for (int i = 1; i < sub.size()-1; i++) {
      |                             ^~~
a.cc:22:13: error: 'sub' was not declared in this scope
   22 |         if (sub[0] == 'C' || sub[sub.size()-1] == 'C') {
      |             ^~~
a.cc:23:17: error: 'cout' was not declared in this scope
   23 |                 cout << "WA" << endl;
      |                 ^~~~
a.cc:23:33: error: 'endl' was not declared in this scope
   23 |                 cout << "WA" << endl;
      |                                 ^~~~
a.cc:27:17: error: 'cout' was not declared in this scope
   27 |                 cout << "WA" << endl;
      |                 ^~~~
a.cc:27:33: error: 'endl' was not declared in this scope
   27 |                 cout << "WA" << endl;
      |                                 ^~~~
a.cc:34:33: error: 'cout' was not declared in this scope
   34 |                                 cout << "WA" << endl;
      |                                 ^~~~
a.cc:34:49: error: 'endl' was not declared in this scope
   34 |                                 cout << "WA" << endl;
      |                                                 ^~~~
a.cc:39:9: error: 'cout' was not declared in this scope
   39 |         cout << "AC" << endl;
      |         ^~~~
a.cc:39:25: error: 'endl' was not declared in this scope
   39 |         cout << "AC" << endl;
      |                         ^~~~