Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "utils.PRO2"
- #include "Palabra.hh"
- int consultar (const Palabra& p) {
- int sub = 1;
- int max = sub;
- if (p.long_pal() > 1) {
- for (int i = 2; i <= p.long_pal(); ++i) {
- if (p.consultar_letra(i-1) == p.consultar_letra(i)) ++sub;
- else {
- if (max < sub) max = sub;
- sub = 1;
- }
- }
- }
- if (max < sub) max = sub;
- return max;
- }
- int main() {
- Palabra p;
- p.leer('.');
- if (p.long_pal() > 0) cout << consultar(p);
- else cout << "0";
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement