fork download
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int d;
  8. string s;
  9. cin>>s;
  10. string c={'0','1','2','3','4','5','6','7','8','9'};
  11. for(int i=0;i<10;i++){
  12. d=0;
  13. for(int j=0;j<s.length();j++){
  14. if(s[j]==c[i]){
  15. d++;
  16. }
  17. }
  18. cout<<d<<" ";
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 5320KB
stdin
lw4n88j12n1
stdout
0 2 1 0 1 0 0 0 2 0