import java.util.Scanner;
public class test02 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String s = in.nextLine();
            System.out.println(HuiWen(s));
        }
    }
   public static boolean HuiWen(String s) {
        int len = s.length();
        int sum=0;
        String res = new StringBuffer(s).reverse().toString();
        for (int i=0;i<s.length();i++)
            if (s.charAt(i)==res.charAt(i)) sum++;
        if (len-sum==0)
        return true;
        else return false;

    }
}

主要是字符串反转

java----回文序列判断java

 

相关文章:

  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
  • 2021-12-25
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案