public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String fileName = reader.readLine();
        reader.close();
        FileReader fileReader = new FileReader(fileName);
        String text = "";
        BufferedReader bReader = new BufferedReader(fileReader);
        String line;
        while ((line = bReader.readLine()) != null) {
            text += line;
        }
        fileReader.close();
        text = text.toUpperCase();  //without it also not worked
        String[] arr = text.split("[\\W]"); //\p{Punct} also not worked
        int i = 0;
        for (String s : arr) {
            if (s.replace(" ", "").equals("WORLD")) i++;
        }
        System.out.println(i);
    }
}