Advertisement
Guest User

dsaj

a guest
Mar 6th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include "utils.PRO2"
  2. #include "Palabra.hh"
  3.  
  4. int sub (Palabra p){
  5. int rmax=1;
  6. int r=1;
  7. char aux;
  8. char auxant=p.consultar_letra(1);
  9. for (int i=2; i<=p.long_pal(); ++i){
  10. aux=p.consultar_letra(i);
  11. if (aux==auxant) r++;
  12. else {
  13. if (r>=rmax) rmax=r;
  14. r=1;
  15. }
  16. auxant=aux;
  17.  
  18.  
  19.  
  20. }
  21. if (r>rmax) rmax=r;
  22. return rmax;
  23.  
  24.  
  25.  
  26.  
  27. }
  28.  
  29. int main()
  30. {
  31. Palabra p;
  32. p.leer('.');
  33. if (p.long_pal()==0) cout<<0<<endl;
  34. else cout<<sub(p)<<endl;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement