시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 0 | 0 | 0 | 0.000% |
Given an arbitrary, syntactically correct Pascal program, you are to compress it. (Note that you do not have to know the programming language Pascal to solve this problem; all relevant information is given below.) Here are the guidelines describing how to compress the program:
’this i
s a string’
’isn’’t this fun?’
(* · · · *)
” or “{ · · · }
”, as in(* This is a comment! *)
{ A comment with a ‘*)’. }
(* A (* comment *)
The input file contains a syntactically correct Pascal program, like this:
{_The_famous_’Hello_world’_program_} program__Hello__(output); __(*_no_declarations_*) begin __WriteLn(’Hello_,__’’quaint’’__world_!’); end.
(Note that space characters are shown as “_” to make them easier to spot.)
The output should be a compressed Pascal program. For example, the program shown above should be reduced to
program_Hello_(output); begin WriteLn(’Hello_,__’’quaint’’__world_!’); end.
{ The famous 'Hello world' program } program Hello (output): (* no declarations *) begin WriteLn('Hello , ''quaint'' world !'); end.
program Hello (output): begin WriteLn('Hello , ''quaint'' world !'); end.