4 {
5 char inputs[501];
6
7 scanf("%s", inputs);
8 char outputs[1001] = "\0";
9
10 unsigned int currentCharLength = 0;
11 char currentChar = inputs[0];
12 for (unsigned int i = 0; i <= strlen(inputs); i++) {
13 if (inputs[i] == currentChar) {
14 currentCharLength++;
15 }
16 else {
17 outputs[strlen(outputs)] = currentChar;
18
19 sprintf(outputs + strlen(outputs), "%u", currentCharLength);
20 outputs[strlen(outputs)] = '\0';
21 currentChar = inputs[i];
22 currentCharLength = 1;
23 }
24 }
25
26 printf("%s\n", outputs);
27
28
29 printf("%.3f", (double)strlen(outputs) / strlen(inputs));
30}