2 solutions

  • -3
    @ 2024-7-24 16:17:45
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
         int t;
         cin>>t;
         while(t--){
              string s;
              cin>>s;
              if(s.size()==1){
                   cout<<s<<endl;
              }
              else{
                   for(int i=0,j=1;i<s.size(),j<s.size();i+=2,j+=2){
                        swap(s[i],s[j]);
                   }
                   cout<<s<<endl;
              }
              
         }
         return 0;
    }
    

    Information

    ID
    91
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    39
    Accepted
    25
    Uploaded By