AT_abc394_c 题解
getchar_unlocked · · 题解
题目传送门
思路
首先不难想到遍历整个字符串,把所有的
所以倒着遍历,这样就会覆盖掉新的
AC CODE
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
for(int i=s.size()-1;i>=1;--i)
if(s[i]=='A'&&s[i-1]=='W')
s[i]='C',s[i-1]='A';
cout<<s<<"\n";
return 0;
}