public static String getCompressedString(String str) {
		String compressedString = "";
		boolean compressed = false;
		int i,j,count;
		for(i=0; i<str.length(); i=j) {
			count=1;
			j=i+1;
			for(; j<str.length() && str.charAt(i) == str.charAt(j); j++)
				count++;
			if(count>1)
				compressed = true;
			compressedString += str.charAt(i)+String.valueOf(count);
		}
		if(compressed)
			return compressedString;
		else
			return str;
	}