Hi I i'd like to make a code in java without arrays with the next purposes:
->read some caracteres separates by (,) like this #,$,%,&,@,_,
->next replace the caracteres who are repeated more than 3 times;
-> next show to user;
i have a code but its not right
public static String IntroduzirLinha(){ Scanner leitor = new Scanner(System.in); System.out.println("De uma frase terminada com "); String token = leitor.next(); String result = "blablablabla"; int aCount = 0; for (int i=0; i<result.length(); i++) { char c = result.charAt(i); switch(result) { case 'a': aCount = aCount +1; break; case 'b': aCount = aCount+1; break; case 'l': aCount = aCount +1; default: System.out.println("Erros in id char"); } } String newString = result.replace('e', 't'); token=leitor.next(); System.out.println(newString); return result; }
I'd like some help please , ty in advance