/*
Steven Spivack
CPSC 1011
Section 002
Lab #6
MAR 3, 2023
This program takes input from txt file through fgets and stores the data into a 2d array
Which is then printed through multiple for loops. 
The length of lines is stored through another for loop.
*/


# include <stdio.h>
# include <string.h>

int main(void){
	const int MAX_LINE = 200;
	const int MAX_LINE_LEN = 100;
	char story[MAX_LINE];
	char story2[MAX_LINE][MAX_LINE_LEN];
	int numLines = 1;

	for (int i = 0; i < MAX_LINE; i++){
		fgets(story, MAX_LINE_LEN, stdin);
		
		strcpy(story2[i], story);
	}

	for(int i = 0; i < MAX_LINE; i++){
		if(strlen(story2[i]) > 1 || strlen(story2[i+1]) > 1){
		numLines += 1;
		}
	}
	
	printf("This poem has %d lines. \n\n\n", numLines);

	for (int i = 1; i < numLines; i++){
		printf("%s", story2[i]);
	}
	
	return 0;
}
