POJ 2271 (HTML)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.