#include <string>
#include <iostream>
#include <cstddef>
// consider 128 ASCII decimal and their coresponding character codes
int charASCIIArray[128] = {0};

void count_char(const std::string& s)
{
   for(const auto& it: s)
   {
        if(('A' <= it && it <= 'Z') ||     // if char between (A,B,....,Z) or
           ('a' <= it && it <= 'z') )      //         between (a,b,....,z)
           charASCIIArray[static_cast<int>(it)]++; // we count each corresponding array then
   }
}

int main()
{
   std::string userinput = "random words WITH *- aLl";

   count_char(userinput);
   for(std::size_t index = 0; index < 128; ++index)
      if(charASCIIArray[index] != 0)
        std::cout << "Letter " << static_cast<char>(index)  // convert back to char
                  << " occured " << charASCIIArray[index] << " times.\n";

   return 0;
}
