Created
January 8, 2021 20:56
-
-
Save apanda/c6c553bc424511d60eecefb2c8f4892f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
int c; | |
int curr_line_length; | |
while ((c = getc(stdin)) != EOF) { | |
if (c == '\n') { | |
printf("%d\n", curr_line_length); | |
curr_line_length = 0; | |
} else { | |
curr_line_length++; | |
} | |
} | |
if (curr_line_length > 0) { | |
printf("%d\n", curr_line_length); | |
} | |
return 0; | |
} |
Author
apanda
commented
Jan 8, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment