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

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

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

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

   constexpr int size = numeric_limits<char>::max() - numeric_limits<char>::min() + 1;
   constexpr int idx_adaption = numeric_limits<char>::min();

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

   vector<int> counter(size);
   string::size_type len = s.length();
   for (string::size_type i = 0; i < len; ++i)
   {
      ++counter[int(s[i]) - idx_adaption];
   }

   for (string::size_type i = 0; i < len; ++i)
   {
      char c = s[i];
      int idx = int(c) - idx_adaption;
      int count = counter[idx];
      if (count != 0)
      {
         cout << '\'' << c << "': " << count << '\n';
         counter[idx] = 0;
      }
   }
}
