public static String compression(String s) {
		
		char[] ss = s.toCharArray();
		int numDiffChars = 1;
		for (int i = 1; i < s.length(); i++) {
			if (ss[i]!= ss[i-1]) numDiffChars++;
		}
		int[] counters = new int[numDiffChars];
		char[] chars = new char[numDiffChars];
		int ind = 0;
		chars[ind] = ss[0];
		counters[ind] = 1;
		
		for (int i = 1; i < s.length(); i++) {
			if (ss[i]==ss[i-1]) counters[ind]++;
			else {
				ind++;
				chars[ind] = ss[i];
				counters[ind] = 1;
			}
		}
		
		String out = "";
		for (int i = 0; i < numDiffChars; i++) {
			out += chars[i] + "" + counters[i]; //this part is O(n^2)!!!
		}
		
		if (out.length()>=s.length()) return s;
		else return out;
	}