package mk;
import java.util.*;
import java.lang.*;
public class My {
public static void main(String[] args) {
// TODO Auto-generated method stub
String a,b="mni nk";
Scanner in=new Scanner(System.in);
a=in.next();
System.out.println(a.replaceAll(" ", ""));
System.out.println(b.replaceAll(" ", ""));
if(a.replaceAll(" ","").equalsIgnoreCase(b.replaceAll(" ","")))
System.out.println("True");
}
}
输出:
mni nk
mni
mnink
Picked up _JAVA_OPTIONS: -Xmx512M
答案 0 :(得分:1)
使用nextLine()
代替next()
:next()
只读取一个令牌,因此a
的值为"mni"
(如输出中所示),而不是"mni nk"
。