Advertisement
Stefan08

varianta59_II_5

Nov 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <climits>
  4. using namespace std;
  5. char x[51];
  6. int ap[10];
  7. int main()
  8. {
  9. int maxi=INT_MIN,i,maxim,ok=0;
  10. cin.getline(x,51);
  11. for(i=0;i<strlen(x);i++)
  12. {
  13. if(x[i]>='0' && x[i]<='9')
  14. {
  15. x[i]=x[i]-48;
  16. ap[x[i]]++;
  17. ok++;
  18. }
  19. }
  20. for(i=0;i<=9;i++)
  21. {
  22. if(ap[i]>maxi)
  23. {
  24. maxi=ap[i];
  25. maxim=i;
  26. }
  27. }
  28. if(ok==0)
  29. {
  30. cout<<"NU";
  31. }
  32. else
  33. {
  34. cout<<maxim;
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement