1048: String reversal score: 1

Source: Internet
Author: User
Title Description

Small c likes to write the words backwards, now give you a line of small C text, you can reverse each word and output them.
Input format

The input contains samples of several sets of test specimens. The first behavior is an integer t, which represents the number of test samples followed by a T test sample.
Each test sample occupies one line and contains multiple words. A line has a maximum of 1000 characters.

Output

For each test sample, you should output the converted text.
Sample input

3
Olleh!dlrow
I Ekil. BULCMCA
I Evol. MCA
Sample output

Hello world!
I like Acmclub.
I Love ACM.

Program p1048;
var n,i,j,k:longint;a,b:ansistring;
Begin
READLN (n);
For I:=1 to N do
Begin
Readln (a);
J:=pos (', a);
While j<>0 do
Begin
B:=copy (a,1,j-1);
For K:=length (b) Downto 1 do
Write (B[k]);
Write (");
Delete (A,1,J);
J:=pos (', a);
End
For K:=length (a) Downto 1 do
Write (A[k]);
Writeln;
End
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.