public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 String a = in.nextLine().toLowerCase(); String b = in.nextLine().toLowerCase(); System.out.println(a.split(b).length-1); }