第三题我帮别人做的但是没提交,自己自测都对。。 public class Main { public static void main(String[] args) throws IOException { StringBuilder tmp=new StringBuilder("ABCCBAAACAB"); int sum=0; while(true){ int index=0; char n=tmp.charAt(index); index++; while (index<tmp.length() && tmp.charAt(index)==n){ index++; } while (index<tmp.length() && tmp.charAt(index)!=n){ index++; } if (index==tmp.length()){ get_lcm(tmp,0,tmp.length()-1);//将字符串整个翻转 System.out.println(tmp); sum++; } boolean flag=false; for (int j = 0; j < tmp.length() - 1; j++) { if (tmp.charAt(j)>tmp.charAt(j+1)){ flag=true; } }
点赞 1

相关推荐

12-11 14:24
门头沟学院 Java
在debug的伊泽瑞...:我说怎么这么眼熟查看图片
点赞 评论 收藏
分享
点赞 评论 收藏
分享
12-24 20:49
武汉大学 Java
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务