Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<fstream>
- using namespace std;
- ifstream fin("cifrazecmax.in");
- ofstream fout("cifrazecmax.out");
- int main()
- {
- int fr[10]= {0},fr1[10]= {0},x,i,c,p=-1;
- i=0;
- while(fin>>x)
- {
- i++;
- c=x/10%10;
- fr[c]++;
- fr1[c]=i;
- }
- int maxim=0;
- for(i=0; i<=9; i++)
- {
- if(maxim<fr[i])
- {
- maxim=fr[i];
- p=i;
- }else
- if(maxim==fr[i] and fr1[p]>fr1[i])
- p=i;
- }
- fout<<fr1[p];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement