//=============================================================================

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

//-----------------------------------------------------------------------------

int main()
{
   cout << "Aufg_10_04_String_Analyse_2_V1\n\n";

   cout << "Eingabe: ";
   string s;
   getline(cin, s);

   map<char, int> counter;
   string::size_type len = s.length();
   for (string::size_type i = 0; i < len; ++i)
   {
      map<char, int>::iterator it = counter.find(s[i]);
      if (it == cend(counter))
      {
         counter.insert({s[i], 1});
      }
      else
      {
         ++it->second;
      }
   }

   for (string::size_type i = 0; i < len; ++i)
   {
      char c = s[i];
      map<char, int>::iterator it = counter.find(c);
      if (it->second != 0)
      {
         cout << '\'' << c << "': " << it->second << '\n';
         it->second = 0;
      }
   }
}
