#include <string>
#include <iostream>
#include <cstddef>

int* count_char(const std::string& s)
{
    // consider 128 ASCII decimal and their coresponding character codes
    int *charASCIIArray = new int[128]{0};
    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
    }
    return charASCIIArray;
}

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

    int *charASCIIArray = 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";

    delete[] charASCIIArray;
    return 0;
}
