CDZSC_2015寒假新人(1)——基础 g
Description
Input
Each test case contains a single line with several words. There will be at most 1000 characters in a line.
Output
Sample Input
olleh !dlrow
m'I morf .udh
I ekil .mca
Sample Output
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
char a[];
int n;
scanf("%d",&n);
getchar();
while(n--)
{
gets(a);
int len=strlen(a);
int next[],m=;
for(int i=;i<=len;i++)
{
if(a[i]==' '||i==len)
{
for(int j=i-;j>=&&a[j]!=' ';j--)
{
next[m++]=j;
}
}
if(a[i]==' ')
{
next[m++]=i;
}
}
for(int i=;i<len;i++)
{
putchar(a[next[i]]);
}
printf("\n");
}
}
Hint
Remember to use getchar() to read '\n' after the interger T, then you may use gets() to read a line and process it.
CDZSC_2015寒假新人(1)——基础 g的更多相关文章
- CDZSC_2015寒假新人(2)——数学 G
G - G Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(1)——基础 e
Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...
- CDZSC_2015寒假新人(1)——基础 i
Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...
- CDZSC_2015寒假新人(1)——基础 h
Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...
- CDZSC_2015寒假新人(1)——基础 f
Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u i ...
- CDZSC_2015寒假新人(1)——基础 d
Description These days, I am thinking about a question, how can I get a problem as easy as A+B? It i ...
- CDZSC_2015寒假新人(1)——基础 c
Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...
- CDZSC_2015寒假新人(1)——基础 b
Description The highest building in our city has only one elevator. A request list is made up with N ...
- CDZSC_2015寒假新人(1)——基础 a
Description Contest time again! How excited it is to see balloons floating around. But to tell you a ...
随机推荐
- C/C++中的sizeof
代码: #include <iostream> #include <string> using namespace std; int main(){ char s1[]=&qu ...
- (原).cc 和 .cpp 后缀结尾的文件的区别
This caused a few problems the first time C++ was ported to a system where case wasn't significant i ...
- Longest Palindromic Substring -LeetCode
题目 Given a string s,find the longest palindromic substring in S.You may assume that the maximum len ...
- linux for循环
一定要记得写后面的分号:http://www.runoob.com/linux/linux-shell-variable.html 这个页面的课程的循环教程是有问题的 for color in yel ...
- JSONP有什么作用
1.解决跨域访问数据 由于同源策略的限制,XmlHttpRequest只允许请求当前源(域名.协议.端口)的资源,为了实现跨域请求,可以通过script标签实现跨域请求 ...
- CSS的权重(转)
CSS写的渐渐多了,他的权重问题就不得不昂首面对,之前一直得过且过的将就用着,直到最近遇到了几个大坑,一直割刺着我对前端的热情,得了得了,蒙不过去了,就发点时间记下来吧,当然还是一片转载的文章,有时候 ...
- AngularJS 父子控制器
<!doctype html> <html ng-app="myApp"> <head> <script src="C:\\Us ...
- C语言解析日志,存储数据到伯克利DB
编译命令 gcc -o dbwriter dbwriter.c -ldb dbwriter.c #include <assert.h> #include <stdlib.h> ...
- [POJ] 3461 Oulipo [KMP算法]
Oulipo Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 23667 Accepted: 9492 Descripti ...
- 迁移笔记:对ob_start()的总结
1.Flush:刷新缓冲区的内容,输出. 函数格式:flush() 说明:这个函数经常使用,效率很高. 2.ob_start :打开输出缓冲区 函数格式:void ob_start(void) 说明: ...