• + 1 comment
        char freq[10]={0}; // all index or Initialised with zero
        char *s = malloc (1024 * sizeof(char)); Allocating memory dynamically
        scanf("%[^\n]",s);
        for(int i = 0;i < strlen(s);i++)
        {
            if (s[i] >= '0' && s[i] <= '9'){ //checking the digit present or not char by char
                freq[s[i]-'0']++;
            }
        }
        for (int i = 0 ; i < 10; i++)
            printf("%d ",freq[i]);
        
        free(s);