blob: 6952c95b5334e8f5b59bfaf7d15d2a7f0793906d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <stdio.h>
void printInt (int a) {
if (a < 0) {
a = -a;
putchar('-');
}
int števke[29];
int len = 0;
while (a > 0) {
števke[len++] = a%10;
a /= 10;
}
for (int i = len-1; i >= 0; i--)
putchar('0'+števke[i]);
}
int main (void) {
while (getchar() == '0');
int po_prvi_enici = 0;
int ni_enic = 1;
while (1)
switch (getchar()) {
case '1':
ni_enic = 0;;
// fall through
case '0':
po_prvi_enici++;
break;
default:
goto done;
}
done:
printInt(++po_prvi_enici-ni_enic);
putchar('\n');
return 0;
}
|