fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. string s ="hello world";
  7. string s1=s.substr(0,5);
  8. reverse(s1.begin(),s1.end());
  9. string s2=s.substr(6,5);
  10. reverse(s2.begin(),s2.end());
  11. s1.append(s2,0);
  12. reverse(s1.begin(),s1.end());
  13. cout<<s1;
  14. return 0;
  15. }
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
worldhello