当前位置:网站首页>阅读顺序
阅读顺序
2022-07-29 16:00:00 【封子墨】
阅读顺序
大多数语言是从左向右读的。但是,在一些语言中,阅读顺序是从右向左读的。这给语言交流增加了不少的麻烦。现在,请你编写一个程序,能够将一从左到右书写的文字自动转成从右向左的顺序。
Input
输入的第一行是一个数字n(n<100),接下来的有n行的文字,由字母、空格、数字以及各种标点组成,每行文字长度不超过200个字符。
Output
将输入的文字转成从右向左的顺序,一行输入对应一行输出。
Sample Input
3
a man a plan a canal panama
Frankly, I don’t think we’ll make much
OK?
Sample Output
amanap lanac a nalp a nam a
hcum ekam ll’ew kniht t’nod I ,ylknarF
?KO
Hint
如果不考虑词与词之间的空格,第一句话从左向右读和从右向左读的结果是一样的:-)
#include<stdio.h>
#include<string.h>
int main()
{
int N;
char a[201];
char b[201];
scanf("%d",&N);
getchar();
while(N--)
{
gets(a);
int len=strlen(a);
for(int i=0;i<len;i++)
{
b[len-1-i]=a[i];
}
for(int i=0;i<len;i++)
printf("%c",b[i]);
printf("\n");
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
Tech Talk 活动回顾|基于 Amazon KVS 打造智能视觉产品
自动化win训练脚本+日志
RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
【Go语言刷题篇】Go完结篇函数、结构体、接口、错误入门学习
浅谈程序的内存布局
Ribbon自定义修改负载均衡
【Leetcode】200. 岛屿数量(中等)
【微服务】 微服务学习笔记二:Eureka注册中心的介绍及搭建
[Server Storage Data Recovery] A data recovery case of a RAID 5 crash caused by the failure of a certain model of Huawei OceanStor storage RAID 5 hard disk and the failure to synchronize data with the
Go语言结构体Go range怎么使用
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
面试突击69:TCP 可靠吗?为什么?
SAP ABAP OData 服务诊断工具 /IWFND/ERROR_LOG 的使用方法试读版
Sentinel热门词汇限流如何实现
[PCL study notes] Commonly used libraries and APIs for point cloud processing (PCL library Eigen)
PL5902 SOT-23-5 高效1MHz2A同步DC-DC降压调节器 百盛电子代理商
Easy Genes: Human tRNA loci exhibit DNA hypermethylation associated with aging | Research Article
string 保留小数点后两位(js中保留小数点后两位)
专访亚信科技张桦:AntDB面向企业核心业务支撑的数据库产品
【C语言刷题】Leetcode268丢失的数字









