Given an arbitrary, syntactically correct, Pascal source program, you are to compress it according to the following guidelines, applied in the order listed: • Replace all sequences of blanks, except those within a string constant, with a single blank. Recall that string constants are delimited by single quotes (’), a string constant must contain at least one character, and that two consecutive single quotes (”) represent the single quote character. e.g., the following are string constants 'this is a string constant' 'don''t you see the fun here?' • eliminate all comments — comments start with (* and are terminated with ) or they start with { and are terminated with }. Remove the entire comment including the end markers (i.e., (, ), { and }). e.g., the following are comments: ( here is a great comment *) { and here is a somewhat longer one } • eliminate any totally blank lines (i.e., any lines, after removing any comments, which consist only of blanks and end-of-line characters — if when printed, or displayed, a blank line would occur, it should be eliminated.) You can assume there will be no tabs or other unusual non-printing characters within the input. Input The input file contains an arbitrary, syntactically correct, Pascal source program. Output Compress the input file into the output file using the rules above. The results should result in a syntactically valid Pascal program; albeit it in a somewhat less stylish form. Sample Input Program Test (input, output); { this is a great program } Var X, Y : begin readln (X, Y); integer ; writeln (X, ' This is Y ', Y, "Hi!') ; end.
2/2 Sample Output Program Test (input, output); Var X, Y : integer ; begin readln (X, Y); writeln (X, ' This is Y ', Y, "Hi!') ; end.