ACM求教
做完笔试的菜鸟又来求教了,感觉很简单的题目,为啥只过50,哪里有问题啊
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] chars = sc.nextLine().toCharArray();
int n= chars.length;
int max =1;
boolean zimu = false;
for (int i = 0; i < n; i++) {
if(chars[i]>='a'&&chars[i]<='z'){
zimu = true;
}
int count =1;
for (int j = i+1; j < n; j++) {
if(chars[j]-'a'==chars[j-1]-'a'+1){
count++;
}else{
max = Math.max(max,count);
break;
}
}
}
if(!zimu){
System.out.println(0);
}else{
System.out.println(max);
}
顺丰集团工作强度 335人发布