题目链接

题解:将每个单词倒置,可以用char数组,然后用空格分隔,这里用的是string和stringstream。
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <cstring>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;
//#define LOCAL int main()
{
#ifdef LOCAL
freopen("in.txt", "r", stdin);
#endif // LOCAL
//Start
int N;
cin>>N;
while(N--)
{
int t;
cin>>t;
getchar();
string s,sss;
getline(cin,s);
stringstream ss(s);
int i=;
while(ss>>sss)
{
string::iterator it=sss.end()-;
if(i++!=)printf(" ");
while(it!=sss.begin())
{
cout<<*it;
it--;
}
cout<<*it;
}
printf("\n");
}
return ;
}

HUST 1339 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. HUST 1328 String (字符串前缀子串个数 --- KMP)

    题意 给定一个字符串S,定义子串subS[i] = S[0..i],定义C[i]为S中subS[i]的数量,求sigma(C[i])(0<=i<N). 思路 我们以子串结尾的位置来划分阶段 ...

  3. zoj 1151 Word Reversal(字符串操作模拟)

    题目连接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1151 题目描述: For each list of words ...

  4. HUST 1404 Hamming Distance(字符串)

    Hamming Distance Description Have you ever heard of the Hamming distance. It is the number of positi ...

  5. Word Reversal (简单字符串处理)

    题目描述: For each list of words, output a line with each word reversed without changing the order of th ...

  6. HUST 1010 The Minimum Length (字符串最小循环节)

    题意 有一个字符串A,一次次的重写A,会得到一个新的字符串AAAAAAAA.....,现在将这个字符串从中切去一部分得到一个字符串B.例如有一个字符串A="abcdefg".,复制 ...

  7. ZOJ 1151 Word Reversal反转单词 (string字符串处理)

    链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=151 For each list of words, output a l ...

  8. HUST 1352 Repetitions of Substrings(字符串)

    Repetitions of Substrings Description The “repetitions” of a string S(whose length is n) is a maximu ...

  9. LA4671 K-neighbor substrings(FFT + 字符串Hash)

    题目 Source http://acm.hust.edu.cn/vjudge/problem/19225 Description The Hamming distance between two s ...

随机推荐

  1. owa_outlook暴力破解脚本

    其实msf里面存在这样的模块,search owa 即可,字典这种东西还是找规律密码去破解比较好 然后担心遇到渗透测试没有msf情况下,还是得自己写个脚本,网上找了一下lijiejie,但是运行不了, ...

  2. FaceBook页面加载技术

    1. 技术背景 FaceBook页面加载技术 试想这样一个场景,一个经常访问的网站,每次打开它的页面都要要花费6 秒:同时另外一个网站提供了相似的服务,但响应时间只需3 秒,那么你会如何选择呢?数据表 ...

  3. JsSIP.UA.JsSIP 总是返回错误:422 Session Interval Too Small

    在JsSIP 中 JsSIP.UA.call 总是 返回错误:422 Session Interval Too Small 关于错详情在这篇文章中解释的比较详尽:http://www.cnblogs. ...

  4. Xsser

    来源:https://www.cqhacker.cn/post-174.html   XSSer使用说明 =============================================== ...

  5. Python学习笔记——基础篇【第五周】——random & time & datetime模块

    random模块 随机数 mport random print random.random() print random.randint(1,2) print random.randrange(1,1 ...

  6. 安装配置Postgresql

    //关闭selinuxgetenforcesetenfroce 0vi /etc/selinux/configSELINUX=disabledSELINUXTYPE=targeted//关闭防火墙#c ...

  7. Apache Storm简介

    Apache Storm简介 Storm是一个分布式的,可靠的,容错的数据流处理系统.Storm集群的输入流由一个被称作spout的组件管理,spout把数据传递给bolt, bolt要么把数据保存到 ...

  8. 使用inno setup制作安装包

  9. imx6平台qt锯齿原因分析

    gbl_alpha:全局alpha 就是设置整个界面的alpha值 loc_alpha 本地alpha 就是图片里面自带的alpha值 color_key color Key 要把界面透出来,就要设置 ...

  10. sudo命令出错 must set be suid

    特殊权限 4,2 ,1 4  suid,控制用户执行的文件,以文件所属用户的身份执行.当一个可执行的文件拥有suid时,会将文件拥有者的x位变成s(---s--x--x),这时称为set uid,简写 ...