一边读一边比较,如果输入的字符串不是 AC,就输出当前序号。
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
signed main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
// freopen("app.in","r",stdin);
// freopen("app.out","w",stdout);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> s;
if(s != "AC")
cout << i << " ";
}
return 0;
}