Compilation successfull,.test case faiiled

import java.util.Scanner;

public class COMPRESSED {

public static void main(String[] args) {
	Scanner input=new Scanner(System.in);
			String str=input.nextLine();
		    compressed(str);
			
}  
public static void compressed(String str) {
	char ch,ci;
	int a,i;
	int n=str.length();
	a=1;
	ci=str.charAt(n-1);
	for(i=0;i<n-1;i++) {
	ch=str.charAt(i);
	ci=str.charAt(i+1);
	
	if(ch==ci) 
	{
		a=a+1;
	}
	else if(a>1) {
		System.out.print(ch+""+a);
		a=1;
	}
	else if(a==1){
		System.out.print(ch);
		a=1;
	}

}
	System.out.print(ci);	

}
}

@KUNAL.SHARMA5724510,
I have corrected your code: https://ide.codingblocks.com/s/208083

Error:
Your code was giving wrong answer for inputs such as:
aaabb
Correct Answer: a3b2
Your Answer a3b

you had to add a condition that if int a is greater than 1 after traversal of string is finished and a>1, then print a as well.