Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- using namespace std;
- void Citire(char* s)
- {
- ifstream fin("sir.in");
- fin.getline(s, 99);
- fin.close();
- }
- void Secv(char* s)
- {
- char secv[99], secvmx[99];
- int lg = -1, lgmx = -1;
- for(int i = 0; s[i] != 0; i++)
- {
- if(s[i] <= s[i+1])
- {
- lg++;
- strncpy(secv+lg, s+i, 2);
- }
- else
- {
- if(lg > lgmx)
- {
- strcpy(secvmx, secv);
- lgmx = lg;
- }
- lg = -1;
- }
- }
- cout << lgmx << "\n";
- cout << secvmx;
- }
- int main()
- {
- char sir[99];
- Citire(sir);
- Secv(sir);
- cout << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement