- /*
- Esercizio sulle stringhe
- Autore: Red Skull 92
- Mail: RedSkull92[AT]gmail[DOT]com
- Web: http://redskull92.wordpress.com
- */
- class Stringhe
- {
- {
- Stringhe a = new Stringhe();
- a.rmDoppie("cciiaaoo");
- }
- {
- int i,conto=0,pos=0;
- for(i=0;i<str.length();i++)
- {
- if(i != str.length() -1 && str.charAt(i)==str.charAt(i+1))
- {
- removed+=str.charAt(i);
- conto++;
- }
- else
- {
- nuova+=str.charAt(i);
- }
- }
- }
- }
Data una stringa qualsiasi, vengano eliminate tutte le doppie consecutive e vengano restituiti/printati
