title: Counting how many times digits repeats in a number
body: <p>You are given a string S. Count the number of occurrences of all the digits in the string S.</p>
  
  <p>Input: 
  First line contains string S.</p>
  
  <p>Output: 
  For each digit starting from 0 to 9, print the count of their occurrences in the string S. So, print 10 lines, each line containing 2 space separated integers. First integer i and second integer count of occurrence of i. See sample output for clarification.</p>
  
  <p>Constraints:1≤|S|≤100</p>
  
  <p>I tried doing it this way. But I'm getting errors.</p>
  
  <p><strong>error: array subscript is not an integer</strong>. and 
  <strong>error: invalid operands to binary</strong>.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;math.h&gt;
  
  int main()
  {
      double a[100],i,k;
      int b[10]={0,1,2,3,4,5,6,7,8,9},sum[10];
      int j;
      gets(a);
      k=strlen(a);
      for(i=0; i&lt;10; i++){
          sum[i]=0;
      }
      for(i=0; i&lt;k; i++){
          a[i]=a/(pow(10,k-i-1));
          for(j=0; j&lt;k; j++){
              if(i+j&lt;10 &amp;&amp; a[i]==a[i+j])
                 sum[i]++;
              else
                  break;
          }
      }
      printf("%d/n",b[i]);
      puts(sum[i]);
      return 0;
  }
  </code></pre>
  
  <p>Please help.</p>