#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
   cout << "Aufgabe 10.1 a - Reihenfolge wie Eingabe\n\n";

   vector<string> names;
   string::size_type maxlen = 0;
   for (;;)
   {
      string name;
      getline(cin, name);
      if (name.empty()) break;
      names.push_back(name);
      if (name.length() > maxlen)
      {
         maxlen = name.length();
      }
   }

   const string stars(11 + maxlen, '*');
   const string spaces(9 + maxlen, ' ');

   cout << stars << "\n*" << spaces << "*\n";
   // Achtung - hier wuerde man eine "const string&" nehmen - lernen wir noch
   for (string name : names)
   {
      const auto len = name.length();
      const string fillspaces(maxlen - len, ' ');
      cout << "* Hallo " << name << "! " << fillspaces << "*\n";
   }
   cout << '*' << spaces << "*\n" << stars << '\n';
}
