Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created September 6, 2021 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/28542abecf4d5229cb62255af2da18e5 to your computer and use it in GitHub Desktop.
Save amankharwal/28542abecf4d5229cb62255af2da18e5 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
int main(){
int i;
int j;
int t;
string input;
cout<<"Enter a Word : ";
cin>>input;
int len = input.length();
for (i = 0; i < len; i++){
for (j = 0; j < len - 1; j++){
if (input[j] > input[j + 1]){
t = input[j];
input[j] = input[j + 1];
input[j + 1] = t;
}
}
}
cout<<input;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment