String processing
Note that Seekeof will automatically eat the space behind it (sometimes when you press enter, there will be a space missing ...... It seems that sometimes there are no spaces to read, so use it with caution when processing strings)
In addition, the Ascii code of space is 32, 31 and below are not allowed to enter characters
[Delphi]
Program P2271;
Var
S: string;
Procedure cin;
Var
C: char;
I, len: longint;
Begin
S: = '';
C: = '';
I: = 0;
While not (seekeof) do
Begin
Read (c );
While (ord (c) <= 32) and not (eof) do read (c );
If ord (c) <= 32 then break;
Repeat
S: = s + c;
If eof then break;
Read (c );
Until (ord (c) <= 32 );
Len: = length (s );
If s = '<br> 'then begin writeln; I: = 0; end
Else
If s = 'Begin
If I> 0 then writeln;
For I: = 1 to 80 do write ('-');
Writeln;
I: = 0;
End
Else
Begin
If (I = 0) then
Begin
If len <80 then
Begin
Write (s );
I: = len;
End;
End
Else
Begin
If (I + 1 + len <= 80) then
Begin
Write (', s );
I: = I + 1 + len;
End
Else
Begin
Writeln;
Write (s );
I: = len;
End;
End;
End;
S: = '';
End;
Www.2cto.com
End;
Begin
{Assign (input, 'p2271. in ');
Assign (output, 'p2271. out ');
Reset (input );
Rewrite (output );
} Cin;
Writeln;
{Close (input );
Close (output );}
End.