题目描述:

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. delphi IsIPAdress 非正则表达式验证IP的方法

    function IsIPAdress(const Value:String):Boolean; var n,x,i: Integer; Posi:Array[..]of Integer; Oktet ...

  2. HTTP状态代码列表

    httpContext.Response.StatusCode=200 1xx - 信息提示这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个 1xx 响应. · 100 - ...

  3. 利用 Azure Devops 创建和发布 Nuget 包

    利用 Azure Devops 创建和发布 Nuget 包 原 Visual Studio Team Service ,简称 VSTS,能够创建 pipelines 管道以构建应用程序,并将其部署到任 ...

  4. WPF Adorner

    之前做项目时,为了实现类似微信消息数目的效果   image.png ,我之前是修改的ControlTemplate.类似于将一个带数字的控件,放在另一个控件的右上角,来实现的这个效果. 原来WPF有 ...

  5. 魔方Newlife.Cube权限系统的使用及模版覆盖详解

    讲人:大石头 时间:2018-11-14 晚上20:00 地点:钉钉群(组织代码BKMV7685)QQ群:1600800 内容:魔方Newlife.Cube权限系统的使用及模版覆盖详解 准备 源码地址 ...

  6. C# json字符串转为对象

    方法1: using System.Web.Script.Serialization; string ss = "{\"NewsCount\":\"3482\& ...

  7. 改变PowerDesigner数据模型字体大小

    一 改变左侧菜单字体大小Tools----->General------->Fonts-------->根据item选项的不同改变字体的大小 二 改变数据模型Table的字体大小To ...

  8. Android开发教程 - 使用Data Binding(五)数据绑定

    本系列目录 使用Data Binding(一)介绍 使用Data Binding(二)集成与配置 使用Data Binding(三)在Activity中的使用 使用Data Binding(四)在Fr ...

  9. Java - 阅读与查找

    WebSites http://www.importnew.com/ https://www.java-tips.org/ http://www.javaworld.com/ http://www.p ...

  10. mac下安装rzsz

    1.先安装item2,item2 市类似mac风格的终端 item2 下载地址,http://iterm2.com/downloads.html,下载后解压缩就能运行 2.Install Homebr ...