-
Re: Java Challenge
try this one.......
public class Problemconverter {
public static void convert(String s){
int len = s.length();
String next;
int count = 1;
if (len == 0)
return ;
else if(len == 1)
System.out.println(count+""+s.charAt(0));
else{
for(int i=0; i<len; i++){
if(s.charAt(i) == s.charAt(i+1)){
count++;
}
else break;
}
System.out.print(count+""+s.charAt(0));
next = s.substring(count);
convert(next);
}
}
public static void main(String[] args) {
convert("10444221");
}
}
-
Re: Java Challenge
:confused: Why are you guys so keen to do someone else's homework for them?
It doesn't help the OP at all because he/she won't learn anything from this assignment and so almost certainly won't be able to do the up coming assignments.
By all means provide guidance but please stop providing the code.
-
Re: Java Challenge
@keang.......
got it......man.......
will provide only guidance here after.......