#include <stdio.h>
#include <stdlib.h>
#include <string.h>


static unsigned o[31];

unsigned c(int a){
   if (a>='a' && a<='z')
      return a-'a';
   if (a>='A' && a<='Z')
      return a+'a'-'A';
   switch (a){
   case ' ':return 26;
   case '.':return 27;
   case ',':return 28;
   case '-':return 29;
   }
   return 30;
}

static int _;


void mur(int j){
   if (o[c(j)])
      printf("[%c]: %-7d%c",j,o[c(j)],
            (_=(_+1)%5)?' ':'\n');
}

void hist(const char* a){
   _=0;
   for (int i=0;i<31;i++)
      o[i]=0;
   for (int i=strlen(a)-1;i>=0;i--)
      o[c(a[i])]++;

   printf("text:\n%s\n====\n",a);
   for (int i=0;i<26;i++)
      mur('a'+i);
   mur(' ');
   mur('.');
   mur(' ');
   mur('-');
   printf("<another>: %d\n\n",o[30]);
}
int main(){
   hist("test");
   hist("The same issue will be exhibited by any classes/functions by-passing operator new to allocate memory, that is, by performing custom memory allocation followed by calls to the placement new operator. This is for instance typically the case of std::make_shared or std::allocate_shared for which is the solution is to use an aligned allocator as detailed in the solution for STL containers");
   return 0;
}
