Advertisement
yanni_yagami

Untitled

Jul 18th, 2020
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void)
  5. {
  6.   char str[256];
  7.  
  8.   scanf("%s", str);
  9.  
  10.   for(int i = 0; i < strlen(str) -2; i += 2)
  11.   {
  12.     for(int j = i+2; j < strlen(str); j += 2)
  13.     {
  14.       if(str[j] < str[i])
  15.       {
  16.         char tmp = str[j];
  17.         str[j] = str[i];
  18.         str[i] = tmp;
  19.       }
  20.     }
  21.   }
  22.  
  23.   printf("%s\n", str);
  24.  
  25.   return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement