提交时间:2022-10-04 11:25:18
运行 ID: 57451
#include<bits/stdc++.h> using namespace std; char a[1919810],b[1919810]; int main() { int t,len; cin>>t; int i,j; for(i=0;i<t;i++) { int n; cin>>n; cin>>a; len=strlen(a); if(len==n) { cout<<a; } else { for(j=0;j<len;j++) { if(a[j]=='m'&&len<n) { cout<<"nn"; len++; continue; } else if(a[j]=='w'&&len<n) { cout<<"uu"; len++; continue; } else if(a[j]=='u'&&a[j+1]=='u'&&len>n) { cout<<'w'; len--; j++; continue; } else if(a[j]=='n'&&a[j+1]=='n'&&len>n) { cout<<'m'; len--; j++; continue; } else if(len>n&&a[j]=='n'&&a[j+1]=='m'&&a[j+2]=='n') { cout<<"mm"; len--; j+=2; continue; } else if(len>n&&a[j]=='u'&&a[j+1]=='w'&&a[j+2]=='u') { cout<<"ww"; len--; j+=2; continue; } cout<<a[j]; } } cout<<endl; } return 0; }