import java.io.*;
import java.util.*;
public class Exercise1
{
public static void main(String args[])
{ int Array[];
Array=new int[100];
String str="";
System.out.println("Please input a string:");
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
str=in.readLine();
}
catch(IOException e)
{}
System.out.println("Output string:");
System.out.println(str);
int i=str.length();
//System.out.println(str);
System.out.print("Sting count:");
System.out.println(i);
/* for(int m=0;m<i/2;m++) //判断有误
{ i--;
Array[i]=str.charAt(i);
if(Array[m]!=Array[i])
{
i--;
break;
}
//else
// break;
if(m<i)
System.out.println("String不是回文数");
else
System.out.println("String是回文数 ");
}*/
int a=str.length()-1;
int b=0;
while(b<a)
{
if(str.charAt(a)==str.charAt(b))
{
a--;
b++;
}
else
break;
}
if(b<a)
System.out.println("String不是回文数");
else
System.out.println("String是回文数");
}
}
import java.util.*;
public class Exercise1
{
public static void main(String args[])
{ int Array[];
Array=new int[100];
String str="";
System.out.println("Please input a string:");
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
str=in.readLine();
}
catch(IOException e)
{}
System.out.println("Output string:");
System.out.println(str);
int i=str.length();
//System.out.println(str);
System.out.print("Sting count:");
System.out.println(i);
/* for(int m=0;m<i/2;m++) //判断有误
{ i--;
Array[i]=str.charAt(i);
if(Array[m]!=Array[i])
{
i--;
break;
}
//else
// break;
if(m<i)
System.out.println("String不是回文数");
else
System.out.println("String是回文数 ");
}*/
int a=str.length()-1;
int b=0;
while(b<a)
{
if(str.charAt(a)==str.charAt(b))
{
a--;
b++;
}
else
break;
}
if(b<a)
System.out.println("String不是回文数");
else
System.out.println("String是回文数");
}
}