fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<map>
  4. #include<algorithm>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int x, y;
  10. string st;
  11. map<int, int> Mymap;
  12. map<int, int>::iterator it;
  13.  
  14. cin>>x>>y;
  15. for(int i=x; i<=y; i++)
  16. {
  17. st="";
  18. while(x>0)
  19. {
  20. st=st+char('0'+x%10);
  21. x/=10;
  22. }
  23. int s=st.length();
  24. for(int j=0; j<s; j++)
  25. {
  26. if(st[j]=='0')Mymap[0]++;
  27. if(st[j]=='1')Mymap[1]++;
  28. if(st[j]=='2')Mymap[2]++;
  29. if(st[j]=='3')Mymap[3]++;
  30. if(st[j]=='4')Mymap[4]++;
  31. if(st[j]=='5')Mymap[5]++;
  32. if(st[j]=='6')Mymap[6]++;
  33. if(st[j]=='7')Mymap[7]++;
  34. if(st[j]=='8')Mymap[8]++;
  35. if(st[j]=='9')Mymap[9]++;
  36. }
  37. }
  38. for(it=Mymap.begin(); it!=Mymap.end(); it++)
  39. {
  40. cout<<it.second()<<" ";
  41. }
  42. cout<<endl;
  43. Mymap.clear();
  44. return 0;
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1 9
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:40:12: error: ‘std::map<int, int>::iterator’ has no member named ‘second’
   cout<<it.second()<<" ";
            ^
prog.cpp:44:10: error: expected ‘}’ at end of input
  return 0;
          ^
stdout
Standard output is empty