#include <iostream>

#include <string>

using namespace std;

//precondition: three different words

//postcondition:returns words in alphabetical order

string WordOrder (string word1, string word2, string word3)

{

if (string word1 < string word2 < string word3)

{ cout << word1 << endl

cout << word2 << endl

cout << word3 << endl

}

else if (word1 < word3 < word2)

{ cout << word1 << endl

cout << word3 << endl

cout << word2 << endl

}

else if (word2 < word1 < word3)

{ cout << word2 << endl

cout << word1 << endl

cout << word3 << endl

}

else if (word2 < word3 < word1)

{ cout << word2 << endl

cout << word3 << endl

cout << word1 << endl

}

else if (word3 < word2 < word1)

{ cout << word3 << endl

cout << word2 << endl

cout << word1 << endl

}

else if (word3 < word1 < word2)

{ cout << word3 << endl

cout << word1 << endl

cout << word2 << endl

}

int main ()

{

string word1, word2, word3;

cout <<"Type the first word: ";

cin >> word1;

cout <<"Type the second word: ";

cin >> word2;

cout <<"Type the third word: ";

cin >> word3;

WordOrder (string word1, string word2, string word3);

return 0;

}