summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--šola/p2/dn/DN01b_63230317.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/šola/p2/dn/DN01b_63230317.c b/šola/p2/dn/DN01b_63230317.c
index cebcc83..6952c95 100644
--- a/šola/p2/dn/DN01b_63230317.c
+++ b/šola/p2/dn/DN01b_63230317.c
@@ -16,9 +16,20 @@ void printInt (int a) {
int main (void) {
while (getchar() == '0');
int po_prvi_enici = 0;
- while ((getchar() & ~1) == '0')
- po_prvi_enici++;
- printInt(++po_prvi_enici);
+ 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;
}