Reverse Text


Time Limit: 2 Seconds      Memory Limit: 65536 KB

In most languages, text is written from left to right. However, there are other languages where text is read and written from right to left. As a first step towards a program that automatically translates from a left-to-right language into a right-to-left language and back, you are to write a program that changes the direction of a given text.


Input Specification

The input contains several test cases. The first line contains an integer specifying the number of test cases. Each test case consists of a single line of text which contains at most 70 characters. However, the newline character at the end of each line is not considered to be part of the line.

Output Specification

For each test case, print a line containing the characters of the input line in reverse order.

Sample Input

3
Frankly, I don't think we'll make much
money out of this scheme.
madam I'm adam

Sample Output

hcum ekam ll'ew kniht t'nod I ,ylknarF
.emehcs siht fo tuo yenom
mada m'I madam

 #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
int n;
string s;
cin >> n;
cin.get();
//getchar();//头文件是#include <cstdio>
while(n--){
getline(cin, s);
reverse(s.begin(), s.end());
cout << s << endl;
}
//system("pause");
return ;
}

zoj 1295 Reverse Text的更多相关文章

  1. TJU Problem 1644 Reverse Text

    注意: int N; cin >> N; cin.ignore(); 同于 int N; scanf("%d\n",&N); 另:关于 cin 与 scanf: ...

  2. HDOJ/HDU 1321 Reverse Text(倒序输出~)

    Problem Description In most languages, text is written from left to right. However, there are other ...

  3. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  4. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  5. "字符反向拼接"组件:<reverse> —— 快应用组件库H-UI

     <import name="reverse" src="../Common/ui/h-ui/text/c_text_reverse"></ ...

  6. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

  7. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  8. input中如何输入逆写的中文句子

    <input style="text-align:right" /><input type="text" dir="rtl" ...

  9. 一位学长的ACM总结(感触颇深)

    发信人: fennec (fennec), 信区: Algorithm 标 题: acm 总结 by fennec 发信站: 吉林大学牡丹园站 (Wed Dec 8 16:27:55 2004) AC ...

随机推荐

  1. 基于node 搭建http2服务

    1.准备工作:安装node2.安装http2: npm install http2 -g安装完成后,在安装目录中appData/Roaming>npm>node_modules>ht ...

  2. 【C#】基础之数组排序,对象大小比较(对比器)

    C#基础之数组排序,对象大小比较 原文链接:[OutOfMemory.CN] 从个小例子开始: 1 2 3 int[] intArray = new int[]{2,3,6,1,4,5}; Array ...

  3. AJPFX关于多线程概述及应用

    一.认识多任务.多进程.单线程.多线程要认识多线程就要从操作系统的原理说起. 以前古老的DOS操作系统(V 6.22)是单任务的,还没有线程的概念,系统在每次只能做一件事情.比如你在copy东西的时候 ...

  4. Activity的创建、生命周期

    Activity是Android四大组件之一.一个Activity负责管理一个界面. 创建一个Activity: New -> Activity -> 选择要创建的Activity类型(一 ...

  5. 如何使用 Java 生成二维码

    步骤 下载jar包(QRCode.jar) maven项目手动引入jar包 编写实体类实现二维码的生成 controller调用 下载jar包(QRCode.jar) 下载网址如下: QRCode生成 ...

  6. poj2184 Cow Exhibition

    思路: dp+滚动数组. 类似01背包. 实现: #include <iostream> #include <cstdio> #include <algorithm> ...

  7. IP地址 子网掩码 默认网关和DNS服务器的关系

    在过去,男人是需要能够上房揭瓦的,是要能够修水管的.现在的男人是需要会装系统的,会设置路由器的.世界变化太快! 废话不多说,本文来讨论一下电脑上最为常见的几个网络参数:IP地址.子网掩码.默认网关和D ...

  8. 求N个数的最大公约数

    使用 “辗转相除法” 计算2个数的最大公因数: int GCD_2(int nNum1, int nNum2) { if (nNum1 > nNum2) { nNum1 = nNum1 ^ nN ...

  9. 职业生涯手记——记人生中第一次经历的产品上线——内测篇Day11

    2017/08/21 产品内测期Day11 说出来可能你不信,原定于9月15号结束的内测活动,今天居然被甲方投诉导致强制停止,原因是这个内测活动没有经过批准,并且有用户打了甲方所在公司的客服部门,增加 ...

  10. JQuery 获得绝对,相对位置的坐标方法

    获取页面某一元素的绝对X,Y坐标,可以用offset()方法:(body属性设置margin :0;padding:0;) var X = $('#DivID').offset().top; var ...