blob: 88ef9a9d983105f8897ea5fe20c7e4ce2a5270f0 (
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
36
37
|
#include <stdio.h>
void printInt (int a) {
if (a < 0) {
a = -a;
putchar('-');
}
int l = 1;
int c = a/10;
while (c > 0) {
l *= 10;
c /= 10;
}
while (l) {
putchar('0'+(a/l)%10);
l /= 10;
}
}
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;
}
|