#include <iostream>

using namespace std;

// This function implements the bubbleSort algorithm.
void sort(char arr[])
{
   bool flag;
   char temp;
   do {
      flag = false;
      for (int i = 0; i < 8; i++)
         if (arr[i] > arr[i + 1]) {
            flag = true;
            temp = arr[i];
            arr[i] = arr[i + 1];
            arr[i + 1] = temp;
         }
   } while(flag);
}

int main()
{
   char arr[9];

   // Prompt the user for input.
   cout << "Input 9 letters: ";
   for (int i = 0; i < 9; i++)
      cin >> arr[i];

   // Sort the array in alphabetical order.
   sort(arr);

   // Display the array.
   for (int i = 0; i < 9; i++)
      cout << arr[i] << " ";

   return 0;
}