import java.util.Scanner; public class Main { public static void main(String[] args) { String string = "H e l l o ! n o w c o d e r"; Scanner scanner= new Scanner(System.in); String word = scanner.next(); scanner.close(); System.out.println(check(string, word)); } public static int check(String str, String word) { //write your code here...... //如果有给定字母,将消掉给定字母的部分,消了多少就出现了多少次 return str.length() - str.replace(word,"").length(); } }