题目描述
给你三个ASCII字符(不含空白字符:包括空格、制表符\t、回车换行符\n),找出其中最大的那个
输入
输入包含三个字符,之间有一个空格隔开。
输出
输出ASCII码最大的那个字符,占一行。
样例输入
a b c
样例输出
c
代码示例
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String[] strList= new String[3];
for (int i=0; i < strList.length; i++) {
strList[i] = sc.next();
}
String result = strList[0];
int resultAscii,middle;
for (int i=1; i < strList.length; i++) {
resultAscii = (int)result.charAt(0);
middle = (int)strList[i].charAt(0);
if (middle > resultAscii) {
result = strList[i];
}
}
System.out.println(result);
}
}