验证中...
Languages: Java
Categories: 算法分析
Latest update 2018-12-09 10:09
gistfile1.txt
Raw Copy
package demo;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
System.out.println(Test.Revres());
}
public static String Revres(){
Scanner Input=new Scanner(System.in);
String s=Input.next();
char[]a=s.toCharArray();
String str="";
for(int i=a.length-1;i>0;i--){
str+=a[i];
}
return str;
}
}
package pac;
public class Test2 {
public static void main(String[] args) {
String str="fdhgj5 7 4 486yioa*/*3249";
char []st=str.toCharArray();
int l=0;
int h=st.length-1;
while(true){
if(l>=h){
break;
}
char temp=st[l];
st[l]=st[h];
st[h]=temp;
l++;
h--;
}
str=new String(st);
System.out.println(str);
}
}

Comment list( 0 )

You need to Sign in for post a comment

Help Search