Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public static void main(String[] args) throws IOException {
- BufferedReader filenameReader = new BufferedReader(new InputStreamReader(System.in));
- try (BufferedReader fileReader = new BufferedReader(new FileReader(filenameReader.readLine()))) {
- String content = fileReader.lines().collect(Collectors.joining(" "));
- int count = (int) Arrays.stream(content.split("\\W+"))
- .filter("world"::equals).count();
- System.out.println(count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement