Advertisement
pablo7890

Untitled

Jan 10th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <cstring>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <fstream>
  5.  
  6. char phrase[201];
  7.  
  8. int main()
  9. {
  10.     scanf("%s",phrase);
  11.     int n = 0;
  12.     for(int i=0; i<=strlen(phrase); i++)
  13.     {
  14.         for(n; n<=strlen(phrase); n++)
  15.         {
  16.             if (phrase[n] <= phrase[n+1])
  17.             {
  18.                 char temp,temp2;
  19.                 temp = phrase[n];
  20.                 temp2=phrase[n+1];
  21.            
  22.                 phrase[n]= temp2;
  23.                 phrase[n+1]=temp;
  24.                 goto main;
  25.                 break;
  26.             }
  27.         }
  28.     }
  29.     main:
  30.     std::cout << phrase;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement