当前位置:网站首页>6.Reversal
6.Reversal
2022-04-23 06:08:00 【linsa_ pursuer】
Enter an English sentence , The sentence contains several words , There is a space between each word . Now you need to reverse every word in the sentence , Then output the sentence after word inversion ( Don't change the order of the previous words )
Input : There is only one line , Include a length that does not exceed 100 String S, Express English sentences .
Output : There is only one line , That is, output the processed English sentences as required .
sample input :Who Love Solo
sample output :ohW evoL oloS
package com;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
System.out.println(words(s.nextLine()));
}
public static String words(String words){
StringBuilder wordsReturn = new StringBuilder();
StringBuilder word = new StringBuilder();
String[] arr = words.split(" ");
for(int i=0;i<arr.length;i++){
word.delete(0,word.length());
for(int j=arr[i].length()-1;j>=0;j--){
word.append(arr[i].charAt(j));
}
if(i==0){
wordsReturn.append(word.toString());
}else{
wordsReturn.append(" ");
wordsReturn.append(word.toString());
}
}
return wordsReturn.toString();
}
}
版权声明
本文为[linsa_ pursuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220533259807.html
边栏推荐
- Understanding and use of tp50, tp90 and tp99
- Pytorch learning record (IV): parameter initialization
- What is the difference between the basic feasible solution and the basic feasible solution in linear programming?
- EditorConfig
- Three ways to create threads
- 金蝶EAS“总账”系统召唤“反过账”按钮
- 在Jupyter notebook中用matplotlib.pyplot出现服务器挂掉、崩溃的问题
- Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
- Pyqy5 learning (4): qabstractbutton + qradiobutton + qcheckbox
- Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.
猜你喜欢

Contrôle automatique (version Han min)

Algèbre linéaire chapitre 2 - matrice et son fonctionnement

List segmentation best practices
![去噪论文——[Noise2Void,CVPR19]Noise2Void-Learning Denoising from Single Noisy Images](/img/9d/487c77b5d25d3e37fb629164c804e2.png)
去噪论文——[Noise2Void,CVPR19]Noise2Void-Learning Denoising from Single Noisy Images

Pytorch Learning record (XIII): Recurrent Neural Network

Anaconda installed pyqt5 and pyqt5 tools without designer Exe problem solving

You cannot access this shared folder because your organization's security policy prevents unauthenticated guests from accessing it

Class loading and classloader understanding

Pytorch学习记录(七):处理数据和训练模型的技巧

Pyqt5 learning (I): Layout Management + signal and slot association + menu bar and toolbar + packaging resource package
随机推荐
What is the difference between the basic feasible solution and the basic feasible solution in linear programming?
编写一个自己的 RedisTemplate
PHP processing JSON_ Decode() parses JSON stringify
PyQy5学习(三):QLineEdit+QTextEdit
Common programming records - parser = argparse ArgumentParser()
线性代数第一章-行列式
Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
PyQt5学习(一):布局管理+信号和槽关联+菜单栏与工具栏+打包资源包
Explain of MySQL optimization
The attendance client date of K / 3 wise system can only be selected to 2019
图像恢复论文简记——Uformer: A General U-Shaped Transformer for Image Restoration
Solution record of slow access speed of SMB service in redhat6
DBCP usage
How does MySQL convert stored seconds into dates
Write your own redistemplate
Use Matplotlib. In Jupiter notebook Pyplot server hangs up and crashes
Exception handling: grab and throw model
Protected (members modified by protected are visible to this package and its subclasses)
EditorConfig
Pytorch learning record (IX): convolutional neural network in pytorch