Advertisement
K_Y_M_bl_C

C

May 22nd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdlib>
  4. #include <iomanip>
  5. #include <vector>
  6. #include <queue>
  7. #include <cstring>
  8. #include <string>
  9. #include <fstream>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15.   int k,f,kn;
  16.   string s;
  17.   while( getline(cin,s) ){
  18.     int i=0;
  19.     while( i<s.length()){
  20.          k=0;
  21.          f=0;
  22.          kn=0;
  23.         while((96<s[i]&&s[i]<123 ||64<s[i]&&s[i]<91) && i<s.length()){
  24.             if(f==0){
  25.                 f=1;
  26.                 kn=i;
  27.             }
  28.             k++;
  29.             i++;
  30.         }
  31.         int schet=0;
  32.         for(int j=kn;j<kn+k/2;j++){
  33.             char r=s[j];
  34.             schet++;
  35.             s[j]=s[kn+k-schet];
  36.             s[kn+k-schet]=r;
  37.  
  38.         }
  39.         i++;
  40.     }
  41.  
  42.     cout<<s<<endl;
  43.     }
  44.  
  45.  
  46.  
  47.  
  48.  
  49.   return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement