AcWing 768. 忽略大小写比较字符串大小
原题链接
简单
作者:
五岁爱吃樟脑丸
,
2025-01-08 18:28:48
,
所有人可见
,
阅读 1
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String str1=sc.nextLine();
String str2=sc.nextLine();
String a=str1.toLowerCase();
String b=str2.toLowerCase();
int minl=Math.min(a.length(),b.length());
int i=0;
for(;i<minl;i++)
{
if(a.charAt(i)<b.charAt(i))
{
System.out.printf("<");
break;
}
else if(a.charAt(i)>b.charAt(i))
{
System.out.printf(">");
break;
}
}
if(i==minl){
if(a.length()==b.length())
System.out.printf("=");
else if(a.length()>b.length())
System.out.printf(">");
else
System.out.printf("<");
}
}
}