title: How to apply the concept of counting occurrences on strings variables in C++
body: <p>following program ca calculate the frequency of ints in an array
  how to apply this concept on string variable because a string is also an array on the back end</p>
  
  <pre><code>using namespace std;
  int counter[10]={0,0,0,0,0,0,0,0,0,0};
  int arr [9][9],x;
  int main()
  {
      srand(time(NULL));
  
      cout&lt;&lt;"enter the array  \n";
      for(int i=0;i&lt;9;i++){
          for(int j=0;j&lt;9;j++){
              arr[i][j]=rand()%10;
          }
      }
  
      for(int i=0;i&lt;9;i++){
          for(int j=0;j&lt;9;j++){
              cout&lt;&lt;arr[i][j]&lt;&lt;" ";
          }
          cout&lt;&lt;endl;
      }
  
  
      for(int i=0;i&lt;9;i++){
          for(int j=0;j&lt;9;j++){
              counter[arr[i][j]]++;
  
          }
      }
  
      for(int j=0;j&lt;10;j++){
            cout&lt;&lt;j&lt;&lt;" : "&lt;&lt;  counter[j]&lt;&lt;endl;
  
          }
      return 0;
  }
  </code></pre>