//Joe Puccio
// I certify that no unauthorized assistance has been received or given in the completion of this work -- Joe Puccio

#include <stdlib.h>
#include <stdio.h>

#define CHARACTERS_PER_OUTPUT_LINE 80

int main(){

	char lineToOutput[CHARACTERS_PER_OUTPUT_LINE+1]; //output carriage return separately. Need a terminating null. 
	lineToOutput[CHARACTERS_PER_OUTPUT_LINE]='\0'; //added terminating null
	int previousCharacter = 0;
	int currentCharacter;
	int currentPositionInLine = 0;

	while((currentCharacter = getchar()) != EOF){

		if(currentCharacter == 10){ //if it's a carriage return (13) or line feed (10). Assuming just line feed. 
			currentCharacter = 32; // replace with space
		}

		if(currentCharacter == 42 && previousCharacter == 42){ //if both are astrisks
			previousCharacter = 94; //replace with carrot
			currentCharacter = 0; 
		}

		if(previousCharacter!=0){
			lineToOutput[currentPositionInLine] = previousCharacter;
			currentPositionInLine++;
		}

		previousCharacter=currentCharacter;

		if(currentPositionInLine == CHARACTERS_PER_OUTPUT_LINE){
			printf("%s",lineToOutput);
			printf("\n");//print a newline
			currentPositionInLine=0;
		}

	}


}
