One testcase has failed

only one one of my testcases is failed.i cannot figure why?

@Akankshaq please share your code

Please share your code here.

import java.util.Scanner;

public class stringCompression {

public static void main(String[] args) {
	// TODO Auto-generated method stub
 Scanner scn= new Scanner(System.in);
 String str= scn.next();
 StringBuilder sb=new StringBuilder();
 for(int i=0;i<str.length();i++) {
	 int count=1; 
	 int k=i;
	 char a=str.charAt(i);
 for(int j=k+1;j<str.length();j++) {
	 if(a==str.charAt(j)) {
		 count++;
		 i++;
	 }
	 
 }
 sb.append(a);
 if(count>1) {sb.append(count);}
 
 }
 System.out.println(sb);
}

}

hi, I am giving you a counter case to your program. eg. abbccccacccd , its expected output is ab2c4ac3d. try to fix your code on your own and let me know if you still face a problem.
thanks…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.