题目描述:

For each list of words, output a line with each word reversed without changing the order of the words.

This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a
blank line followed by N input blocks. Each input block is in the format
indicated in the problem description. There is a blank line between
input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.

Input

You will be given a number of test cases. The first line
contains a positive integer indicating the number of cases to follow.
Each case is given on a line containing a list of words separated by one
space, and each word contains only uppercase and lowercase letters.

Output

For each test case, print the output on one line.

Sample Input

1

3
I am happy today
To be or not to be
I want to win the practice contest

Sample Output

I ma yppah yadot
oT eb ro ton ot eb
I tnaw ot niw eht ecitcarp tsetnoc

 //题意描述:输入一个字符串,不改变单词的顺序,将每个单词反转输出
//解题思路: 用gets读入,去头去尾后,判断出一个单词,将其复制到另一个字符串中逆序输出,直至字符串尾即可
#include<stdio.h>
#include<ctype.h>
#include<string.h> void pri(char p[])
{
int i,l=strlen(p);
for(i=;i<l;i++)
printf("#%c",p[i]);
printf("\n");
} int main()
{
int T,r,i,j,k;
char s[],*p=NULL,s2[];
scanf("%d",&T);
while(T--)
{ scanf("%d",&r);
getchar();
while(r--)
{
gets(s);
int l=strlen(s);
s[l]='\0';
//pri(s); p=s;
while(!isalpha(*p))
{
p++;
}
//pri(p); l=strlen(p);
for(i=l-;i>=;i--)
if(isalpha(p[i]))
break;
p[i+]=' ';
p[i+]='\0';
//pri(p); l=strlen(p);
for(i=;i<l;)
{
j=;
while(isalpha(p[i]))
{
s2[j++]=p[i++];
}
s2[j]='\0'; for(k=j-;k>=;k--)
printf("%c",s2[k]); if(i==l-)
printf("\n");
else
printf(" ");
i++;
}
}
if(T != )
printf("\n");
}
return ;
}
//易错分析
//gets之前要吃掉换行

Word Reversal (简单字符串处理)的更多相关文章

  1. zoj1151 zoj1295 Word Reversal 字符串的简单处理

    Word Reversal Time Limit: 2 Seconds      Memory Limit:65536 KB For each list of words, output a line ...

  2. CF 208A Dubstep(简单字符串处理)

    题目链接: 传送门 Dubstep Time Limit: 1000MS     Memory Limit: 32768 KB Description Vasya works as a DJ in t ...

  3. C# 利用占位符替换word中的字符串和添加图片

    利用占位符替换word中的字符串和添加图片   ///<summary>         /// 替换word模板文件内容,包括表格中内容         /// 调用如下:WordStr ...

  4. 第一部分之简单字符串SDS(第二章)

    一,什么是SDS? 1.引出SDSC字符串:c语言中,用空字符结尾的字符数组表示字符串简单动态字符串(SDS):Redis中,用SDS来表示字符串.在Redis中,包含字符串值的键值对在底层都是由SD ...

  5. hdu 5059 简单字符串处理

    http://acm.hdu.edu.cn/showproblem.php?pid=5059 确定输入的数是否在(a,b)内 简单字符串处理 #include <cstdio> #incl ...

  6. aspose.word 使用简单方法

    aspose.word使用简单方法 概念介绍 使用aspose生成word报表步骤: 加载word模板 提供数据源 填充 加载模板 提供了4种重载方法 1 2 3 4 5 public Documen ...

  7. C 封装一个通用链表 和 一个简单字符串开发库

    引言 这里需要分享的是一个 简单字符串库和 链表的基库,代码也许用到特定技巧.有时候回想一下, 如果我读书的时候有人告诉我这些关于C开发的积淀, 那么会走的多直啊.刚参加工作的时候做桌面开发, 服务是 ...

  8. 1442: Neo 的简单字符串(字符串)

    1442: Neo 的简单字符串 时间限制: 10 Sec 内存限制: 128 MB 提交: 9 解决: 3 统计 题目描述 Neo 给你一系列字符串,请你输出字符串中的不同单词个数以及总单词个数. ...

  9. java使用poi读取word(简单,简约,直观)

    java使用poi读取word(简单,简约,直观) 说明 其实poi的官网上面都是有接口和样例的,只是都是英文 例如网址:http://poi.apache.org/spreadsheet/quick ...

随机推荐

  1. poj 3083 Children of th

    #include <iostream> #include<stdio.h> #include<string.h> using namespace std; int ...

  2. Oracle EBS登陆后,直接打开某个特定Form/Page

    http://blog.csdn.net/pan_tian/article/details/8169339 有一个小技巧,Oracle EBS登陆后可以绕过职责和功能的选择过程,就可以直接打开某个特定 ...

  3. php支持连接sqlserver数据库

    php支持连接sqlserver数据库 1.软件配置 Win7 64 +wampserver2.2d-x32+SQL Server 2008 R2数据库,wamp2.2中的php版本是5.3.10. ...

  4. phpize增加php模块

    phpize增加php模块 张映 发表于 2010-02-09 分类目录: php 一,phpize的好处 什么时候我们要用phpize呢?我们在安装php时: './configure' '--pr ...

  5. ElectronNetTest

    系统环境:Ubuntu 18.04.2 Desktop 软件环境:asp.net core 2.2,Node.js(version>8.6) Github上有人说不支持 asp.net core ...

  6. 迁移桌面程序到MS Store(4)——桌面程序调用Win10 API

    上一篇我们讨论了如何在转制的桌面程序中,通过StartupTask来实现转制版本的开机自启动.实际操作中,我们通过编辑Packaging工程中的Package.appxmanifest文件,来添加自启 ...

  7. AEAI Portal 权限体系说明

    1.概述 在数通畅联的产品体系中,AEAI Portal毫无疑问的占据了很重要的地位,在这里我们将通过参考Portal样例,讲述一下AEAI Portal权限体系的控制方法.在Portal使用过程中, ...

  8. sudo: 没有终端存在,且未指定 askpass 程序

    问题:sudo: 没有终端存在,且未指定 askpass 程序 解决: sudo visudo 增加如下一行: neutron    ALL=(ALL)    NOPASSWD:ALL

  9. 201621123018《Java程序设计》第5周学习报告

    1. 本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 接口.interface.implements.Comparable.Comparator. 1.2 尝试使用思维导图将这些关键 ...

  10. 浅谈getResource方法

    项目经常会读取一些配置文件, 因此getResource方法便能够起到重要作用 使用时主要是两种方法, 一个是字节码文件Class类, 另一个是ClassLoader类加载器 使用Class类时有两种 ...