diff --git a/du6/program.c b/du6/program.c index 8ea6629..4974c83 100644 --- a/du6/program.c +++ b/du6/program.c @@ -77,14 +77,13 @@ int main(void){ char line[SIZE]; - while( fgets(line, sizeof(line), stdin)){ - line[strcspn(line, "\n")] = '\0'; - if(line[0] == '\0'){ - whitespace = true; - break; - } + while( fgets(line, sizeof(line), stdin)){ + if(strcmp(line, "\n\n") == 0){ + whitespace = true; + break; + } - } + } int numOfLeaves = count_leaves(tree); char answer[SIZE]; bool exs = false;