reverse the string
来源:互联网 发布:开淘宝店铺能挣钱吗 编辑:程序博客网 时间:2024/05/15 15:09
问题:
Description
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
解题思路:
用字符串类型便利s获取一串字符,并放入向量中,将向量倒置(用reverse),然后输出
细节处理:
在输入组数n后,要用一个字符串抵消换行,要注意在每次循环后都要清空向量
代码:
- reverse the String
- reverse the string
- The Solution to Leetcode 344 Reverse String
- Given an input string, reverse the string word by word.
- Given an input string, reverse the string word by word.
- Reverse string
- String Reverse
- reverse string
- string reverse
- reverse string
- reverse string
- Reverse String
- reverse string
- Reverse String
- Reverse String
- Reverse String
- Reverse String
- Reverse String
- Git设置忽略排除和重新添加已经被忽略过文件(夹)的方法
- Java day3
- P
- 编写高质量的JavaScript
- 题目1015:还是A+B
- reverse the string
- 用优先队列优化后的dijkstra算法模板
- C++第二次实验-选择程序设计-项目1(个人所得税计算器)
- 自学Android之UI组件:(一)ListView功能详解And实战
- python学习-集合、字典
- Android7.0_官方文档
- 文章标题
- 每天一个Linux命令(10):cat 命令
- 题目1048:判断三角形类型