пожалуйста
package com.javarush.task.task19.task1922;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Ищем нужные строки
*/
public class Solution {
public static List<String> words = new ArrayList<String>();
static {
words.add("файл");
words.add("вид");
words.add("В");
}
public static void main(String[] args) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fn = reader.readLine();
reader.close();
FileReader fr = new FileReader(fn);
BufferedReader br = new BufferedReader(fr);
while(br.ready()){
String text = br.readLine();
String[] str = text.split(" ");
int count = 0;
for(String s : str){
for(String t : words){
if(t.equals(s)){
count++;
}
}
if(count == 2){
for(String t : words){
if(t.equals(s)){
System.out.println(t);
}
}
}else{count = 0;}
}
}
fr.close();
br.close();
}
}