能加就能减,减去一个成回文也可,依次判断,嗨哟一种办法每次判断左右两边末端字符是否相等,相等就去点接着判断,如果不相等,就加一个判断是否是回文,不是直接返回false

import java.util.*;
public class Main{
    public static  void main(String[] args){
        Scanner input = new Scanner(System.in);
        
            String str ;
            boolean re=false;
            String op="";
        while(input.hasNext()){
                str = input.next();
            re = false;
                for(int i=0;i<str.length();i++){
                    if(i==0){
                        op = str.substring(1,str.length());
                    }else{
                        if(i == str.length()-1){
                            op = str.substring(0,str.length()-1);
                        }else{
                        op = str.substring(0,i)+str.substring(i+1,str.length());
                        }
                    }
                    re = panduan(op);
                    if(re){
                        System.out.println("YES");
                        break;
                    }
                }
                if(re == false){System.out.println("NO");}
        }
       
    }
    public static boolean panduan(String s){
        char[] list = s.toCharArray();
        int i=0,j=list.length-1;
        while(i<j){
            
            if(list[i] != list[j]){
                return false;
            }
            i++;
            j--;
        }
        return true;
    }
}