import java.util.*;

public class Zipper {
    public String zipString(String iniString) {
        // write code here
        char a = iniString.charAt(0);
        int num = 1;
        StringBuilder sb = new StringBuilder();

        for (int i = 1; i < iniString.length(); i++) {

            if (iniString.charAt(i) == a) {
                num++;
            } else {
                sb.append(a);
                sb.append(num);
                a = iniString.charAt(i);
                num = 1;
            }
            if (i == iniString.length() - 1) {
                sb.append(a);
                sb.append(num);
            }

        }

        return (iniString.length() < sb.length() ? iniString : sb.toString());

    }
}