public static String compress(String s) {
        if(s.length() <= 1) {
            return s;
        }
        
        char c = s.charAt(0);
        StringBuilder sb = new StringBuilder();
        int count = 0;
        
        for(int i = 0; i < s.length(); i++) {
            if(c == s.charAt(i)) {
                count++;
            }
            else {
                sb.append(c);
                sb.append(count);
                c = s.charAt(i);
                count = 1;
            }
        }
        
        sb.append(c);
        sb.append(count);
        
        return s.length() <= sb.length() ? s : sb.toString();
    }