lcout << "Enter a string of characters terminated with
'0'." <<
l// endl;
l List<char> L; //Declare a list of characters
named L
l char c;
l cin >> c;
l L.Insert(c); //Puts first value in L
l cin >> c;
l while (c != '0') //Waits for 0 input to stop
l {
l if (c < L.Peek())
L.Reset(); //if c is too
small, reset
l//and start from the beginning
l while
(L.Length_of_Rem() && (c > L.Peek()))
l L.Advance(); //advance to the correct spot
l L.Insert(c); //now that we are at the correct postition,
l//insert the character
l cin >> c; //and take the next
character
l }
l L.Reset(); //Reset the list so we can output
from the beginning
l cout << "The
sorted data is as follows:" << endl;
l while
(L.Length_of_Rem()) //while
Rem is not empty
l {
l cout << L.Peek()
<< ' '; //output each element of the list
l L.Advance();
l }
l cout <<
endl;
l////////////////////////////