fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define el '\n'
  5.  
  6.  
  7.  
  8. void solve() {
  9. ll n;
  10. string s;
  11. cin>>n>>s;
  12. string ans="";
  13. ans+=s[0];
  14. for(int i=1;i<n;i++){
  15. if(s[i-1]=='n' && s[i]=='a'){
  16. ans+='y';
  17. ans+=s[i];
  18. }
  19. else ans+=s[i];
  20. }
  21. cout<<ans;
  22. }
  23.  
  24.  
  25.  
  26. int main() {
  27. ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  28. int tc = 1;
  29. //cin >> tc;
  30. while (tc--) {
  31. solve();
  32. cout << el;
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0s 5344KB
stdin
Standard input is empty
stdout