Pomoze ktos? Chce zeby po wpisaniu "ooozzzdoo" pokazalo "3o3zd2o"
Co mam poki co:
class Main {
public static String StringChallenge (String str) {
String var=" ";
int count = 1;
for (int i=0; i<str.length(); i++) {
for (int j=1; j<str.length(); j++) {
var = var + str.charAt(i);
if (str.charAt(i) == str.charAt(j)) {
count = count + 1;
System.out.print(count + "" + str.charAt(i));
count = 1;
}
}
}
return var;
}
public static void main (String[] args) {
String test = "ooozzzdoo";
StringChallenge(test);
}
}