title: Incorrect output when calculating digit frequency
body: <p>Hey guys there is a problem im occuring in this code which basically works on my compiler but the results in hacker rank shows me that the code is wrong.Please check it out.
  The problem is about digit frequency.
  Given a string, , consisting of alphabets and digits, find the frequency of each digit in the given string.
  My code was:</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  
  
  
  
  int main()
  
  {
  
      char str[1000];
  
      gets(str);
      printf(&quot;%s\n&quot;,str);// test case 1
      int a[9],i,j;//taking integers
      for(i = 0 ; i&lt;9 ; i++)
      {
          a[i] = 0;//giving 0 value to all of the arrays
      }
      for(j = 0; str[j]!= '\0' ; j++) // main task
      {
          if(str[j] == '0')
          {
             a[0] = a[0] + 1;
          }
         else if(str[j] == '1')
          {
             a[1] = a[1] + 1;
          }
         else if(str[j] == '2')
          {
             a[2] = a[2] + 1;
          }
         else if(str[j] == '3')
          {
             a[3] = a[3] + 1;
          }
         else if(str[j] == '4')
          {
             a[4] = a[4] + 1;
          }
         else if(str[j] == '5')
          {
             a[5] = a[5] + 1;
          }
         else if(str[j] == '6')
          {
             a[6] = a[6] + 1;
          }
         else if(str[j] == '7')
          {
             a[7] = a[7] + 1;
          }
   
        else if(str[j] == '8')
          {
             a[8] = a[8] + 1;
          }
          else if(str[j]=='9')
          {
             a[9] = a[9] + 1;
          }  }
       for(i = 0 ; i&lt;=9 ; i++)
      {
          printf(&quot;%d &quot;,a[i]);
      }
  }
  </code></pre>
  <p>Result:</p>
  <p>input (stdin)</p>
  <pre><code>73348t9895298h768464894a958zda58
  </code></pre>
  <p>Expected Output</p>
  <pre><code>0 0 1 2 4 3 2 2 7 5
  </code></pre>
  <p>I got the same output in my codeblocks compiler but still my testcases are not being succeed. Please help!</p>