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) { int sum = 0; //write your code here...... for(int i = 0;i < str.length();i++){ char s = str.charAt(i); if(s == word.charAt(0) && s != ' '){ sum++; } } return sum; } }