解题思路:这是一道简单的模拟题,先判断两个字符串的长度是否相等,再判断是否完全相同,然后再判断忽略大小写的情况下,两个字符串是否相同
注意事项:
参考代码:
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import javax.management.RuntimeErrorException;
public class Main {
static class InputReader
{
public BufferedReader br;
public StringTokenizer tokenizer;
public InputReader(InputStream ins)
{
br=new BufferedReader(new InputStreamReader(ins));
tokenizer=null;
}
public String next()
{
while(tokenizer==null||! tokenizer.hasMoreTokens())
{
try {
tokenizer=new StringTokenizer(br.readLine());
} catch (Exception e) {
// TODO: handle exception
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt()
{
return Integer.parseInt(next());
}
public Long nextLong()
{
return Long.parseLong(next());
}
public double nextDouble()
{
return Double.parseDouble(next());
}
public String nextLine() throws IOException
{
return br.readLine();
}
}
public static InputReader in;
public static PrintWriter out;
static int N=200000;
static int mod=10007;
static class Task
{
public void solve(InputReader in,PrintWriter out)
{
Scanner sc=new Scanner(System.in);
String s1=sc.next();
String s2=sc.next();
int len1=s1.length();
int len2=s2.length();
if(len1!=len2)
{
out.println(1);
}
else
{
if(s1.equals(s2))
{
out.println(2);
}
else
{
s1=s1.toLowerCase();
s2=s2.toLowerCase();
if(s1.equals(s2))
{
out.println(3);
}
else
{
out.println(4);
}
}
}
}
}
public static void main(String[] args) throws IOException{
//InputStream ins=new FileInputStream("C:\\input.txt");
InputStream ins=System.in;
in=new InputReader(ins);
out=new PrintWriter(System.out);
new Task().solve(in, out);
out.close();
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:627 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:1276 |
2^k进制数 (C++代码)使用递归方法浏览:736 |
剔除相关数 (C语言代码)浏览:1058 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:1263 |
C语言考试练习题_保留字母 (C语言代码)浏览:743 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:583 |
星期判断机 (C语言代码)浏览:892 |
企业奖金发放 (C语言代码)浏览:2462 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:416 |