Advertisement
Farjana_akter

Untitled

Jun 10th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int ll;
  4. map<int,ll>mp;
  5.  
  6.  
  7. void fun(string s)
  8. {
  9. for(int i=0;i<s.size();i++)
  10. {
  11. if(s[i]=='0')
  12. mp[0]++;
  13. else if(s[i]=='1')
  14. mp[1]++;
  15. else if(s[i]=='2')
  16. mp[2]++;
  17. else if(s[i]=='3')
  18. mp[3]++;
  19. else if(s[i]=='4')
  20. mp[4]++;
  21. else if(s[i]=='5')
  22. mp[5]++;
  23. else if(s[i]=='6')
  24. mp[6]++;
  25. else if(s[i]=='7')
  26. mp[7]++;
  27. else if(s[i]=='8')
  28. mp[8]++;
  29. else if(s[i]=='9')
  30. mp[9]++;
  31. }
  32. }
  33.  
  34.  
  35.  
  36. int main()
  37. {
  38. // freopen("input.txt","r",stdin);
  39. // freopen("output.txt","w",stdout);
  40. //string a,b;
  41. ll a,b,i,j,k,c;
  42. while(cin>>a>>b)
  43. {
  44. if(a==0 && b==0)
  45. break;
  46. mp.clear();
  47. for(i=a;i<=b;i++)
  48. {
  49. string s=to_string(i);
  50. // cout<<s<<endl;
  51. fun(s);
  52. }
  53. for(auto i=mp.begin();i!=mp.end();i++)
  54. cout<<i->second<<" ";
  55. cout<<endl;
  56. }
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement