A - Sequence of Strings

Problem Statement

You are given �N strings �1,�2,…,��S1​,S2​,…,SN​按此顺序。

按此顺序打印。��,��−1,…,�1SN​,SN−1​,…,S1​

约束

  • 1≤�≤101≤N≤10
  • N is an integer.
  • ��Si​ is a string of length between 11 and 1010, inclusive, consisting of lowercase English letters, uppercase English letters, and digits.

Input

The input is given from Standard Input in the following format:

N
�1S1​
�2S2​
⋮⋮
��SN

Output

Print �N lines. The �i-th (1≤�≤�)(1≤iN) line should contain ��+1−�SN+1−i​.

Sample 1

InputcopyOutputcopy
3
Takahashi
Aoki
Snuke
Snuke
Aoki
Takahashi

We have �=3N=3, �1=S1​= Takahashi, �2=S2​= Aoki, and �3=S3​= Snuke.

Thus, you should print SnukeAoki, and Takahashi in this order.

Sample 2

InputcopyOutputcopy
4
2023
Year
New
Happy
Happy
New
Year
2023

The given strings may contain digits.

题解:

1:创建一个二维数组;记录它的序号和字符串。

2:倒序输出

#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[100][100];
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    getchar();
    for(int i=n-1;i>=0;i--)
        cout<<a[i]<<endl;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值