Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < iostream >
- #include < fstream >
- using namespace std;
- ifstream f("secventaincadrata.in");
- ofstream g("secventaincadrata.out");
- int cif, poz[10], lung[10], c, lungmax;
- int main()
- {
- while (f >> cif)
- {
- ++c;
- if (poz[cif]==0) { poz[cif]=c; lung[cif]=1; }
- else lung[cif]=c-poz[cif]+1;
- }
- for (cif=0; cif < 10; ++cif)
- if (lung[cif] > lungmax) lungmax=lung[cif];
- g << lungmax << "\n";
- for (cif=0; cif < 10; ++cif)
- if (lung[cif]==lungmax) g << cif << " ";
- }
- Citește mai multe pe Brainly.ro - https://brainly.ro/tema/5844981#readmore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement