import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static Scanner sc = new Scanner(System.in); public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { String s = sc.next(); change(s); } static void change(String s){ if(s == null || s.isEmpty()){ return; } int n = s.length(); char[] arr = s.toCharArray(); boolean first = true; char lastChar = arr[0]; int cnt = 1; for(int i=1;i<n;i++){ if(arr[i] == lastChar){ cnt++; }else { if(first) { System.out.print(lastChar + "_" + cnt); first = false; }else { System.out.print("_" + lastChar + "_" + cnt); } lastChar = arr[i]; cnt = 1; } } if(cnt != 0) { if (first) { System.out.print(lastChar + "_" + cnt); }else { System.out.print("_" + lastChar + "_" + cnt); } } System.out.println(); } } /* aaabbbbcccd a_3_b_4_c_3_d_1 offerofferzainaliiiiii o_1_f_2_e_1_r_1_o_1_f_2_e_1_r_1_z_1_a_1_i_1_n_1_a_1_l_1_i_6 hhhaaa h_3_a_3 */