eg_6
问题描述:
将一句话的单词进行倒置,标点不倒置。比如 I like beijing. 经过函数后变为:beijing. like I
Demo1:
import java.util.Scanner;
public class Solution {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
String[] s1 = input.split(" ");
StringBuffer s2 = new StringBuffer();
for(int i=s1.length-1;i>=0;i--){
s2.append(s1[i]+" ");
}
System.out.println(s2.toString());
}
}
运行结果:
I like beijing.
beijing. like I
eg_6的更多相关文章
随机推荐
- delphi黑色背景模式
uses Vcl.Styles, vcl.Themes; procedure TForm1.FormCreate(Sender: TObject); begin TStyleManager.LoadF ...
- ES6的Promise对象
http://es6.ruanyifeng.com/#docs/promise Promise 对象 Promise 的含义 基本用法 Promise.prototype.then() Promise ...
- springboot热部署(一)——Java热部署与热加载原理
一.概述 在应用运行的时升级软件,无需重新启动的方式有两种,热部署和热加载. 对于Java应用程序来说, 热部署就是在服务器运行时重新部署项目,——生产环境 热加载即在在运行时重新加载class,从而 ...
- Java基础—IO小结(一)概述与节点流
一.File类的使用 由于file类是一个基础类,所以我们从file类开始了解.(SE有完善的中文文档,建议阅读) 构造器: 常用方法:——完整方法请参见API API API!!! File做的是 ...
- Noip前的大抱佛脚----奇技淫巧
STL函数 set set查找前驱后继 multiset<int>::iterator iter; S.insert(x); iter=S.find(x);//返回迭代器 iter--;/ ...
- django学习笔记(3)
Part 3: Views and templates ====> Write your first view$ edit polls\views.py from django.http imp ...
- wpf 中Listbox获取选中的值
布局代码: <ListBox Name="listBox1" Width="120" Height="52" SelectionC ...
- P4427 [BJOI2018]求和
P4427 [BJOI2018]求和 同[TJOI2018]教科书般的扭曲虚空 懒得写了(雾 #include<bits/stdc++.h> #define il inline #defi ...
- 【无图慎入】Link Cut Tree 总结
link-cut tree 动态树(准确说是维护森林)之一,支持连边,断边,求链上权值和等操作. splay基础:会rotate和splay就行.还要会一点区间反转操作打标记.很基♂础的东西. 有重链 ...
- Cloud Native Weekly | 华为云抢先发布Redis5.0,红帽宣布收购混合云提供商 NooBaa
1——华为云抢先发布Redis5.0 2——DigitalOcean K8s服务正式上线 3——红帽宣布收购混合云提供商 NooBaa 4——微软发布多项 Azure Kubernetes 服务更新 ...