Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main ()
- {
- char str[256];
- int j;
- bool boo = true;
- cin>>str;
- for (int i=0;i<strlen(str)&&boo;i++)
- {
- boo = false;
- for (j=0;j<strlen(str) - i -1;j++)
- {
- if (str[j] > str[j+1])
- {
- swap(str[j],str[j+1]);
- boo=true;
- }
- }
- }
- cout<<str<<endl;
- }
Add Comment
Please, Sign In to add comment