Program in C++ to count frequency of each elements of array. string