# Digit Frequency | hackerrank practice problem solution

__ Problem:-__

Input Format

The first line contains a string, which is the given number.

Constraints

All the elements of num are made of english alphabets and digits.

Output Format

Print ten space-separated integers in a single line denoting the frequency of each digit from to .

Sample Input 0

a11472o5t6

Sample Output 0

0 2 1 0 1 1 1 1 0 0

Explanation 0

In the given string:

- occurs two times.
- and occur one time each.
- The remaining digits and don’t occur at all.

Sample Input 1

lw4n88j12n1

Sample Output 1

0 2 1 0 1 0 0 0 2 0

Sample Input 2

1v88886l256338ar0ekk

Sample Output 2

`1 1 1 2 0 1 2 0 5 0 `

__Solution:-__

#include <stdio.h>

#include <string.h>

#include <math.h>

#include <stdlib.h>

int main() {

char s[1000];

int a[10],x;

scanf(“%s”,s);

for(int i=0;i<10;i++)

a[i]=0;

for(int i=0;s[i];i++)

{

x=s[i];

if(x>=48&&x<=57)

{

a[x–48]++;

}

}

for(int i=0;i<=9;i++)

printf(“%d “,a[i]);

return 0;

}

__Recommended post:-__

__Hackerearth Problems:-__

- Very Cool numbers | Hacker earth solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem

__
__

__Hackerrank Problems:-__- Playing With Characters | Hackerrank practice problem solution
- Sum and Difference of Two Numbers | hackerrank practice problem solution
- Functions in C | hackerrank practice problem solution
- Pointers in C | hackerrank practice problem solution
- Conditional Statements in C | Hackerrank practice problem solution
- For Loop in C | hackerrank practice problem solution

__Data structure:-__

- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree

__Key points:-__