Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <sstream>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. string switcharoo(string s)
  9. {
  10. istringstream in(s) ;
  11. string result ;
  12.  
  13. string token ;
  14. while ( in >> token )
  15. {
  16.  
  17. if (token.length() > 3)
  18. random_shuffle( &token[1], &token[token.length()-1]) ;
  19.  
  20. result += token ;
  21. result += ' ' ;
  22. }
  23.  
  24. return result ;
  25. }
  26.  
  27. int main(){
  28. string stmt;
  29. getline(cin, stmt);
  30. stmt = switcharoo(stmt);
  31. cout << stmt;
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement