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, "UTF-8"));
FileReader file = new FileReader(reader.readLine());
reader.close();
StringBuilder bigS = new StringBuilder();
int count = 0;
while (file.ready()) {
int data = file.read();
bigS.append((char) data);
}
file.close();
String[] splitFile = bigS.toString().split("\n");
for(String s : splitFile) {
for(String word : words) {
Pattern pattern = Pattern.compile(word);
Matcher matcher = pattern.matcher(s);
while(matcher.find()) count++;
}
if(count == 2) System.out.println(s);
count = 0;
}
}
}package com.javarush.task.task19.task1922;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
Ищем нужные строки
*/
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, "UTF-8"));
FileReader file = new FileReader(reader.readLine());
reader.close();
StringBuilder bigS = new StringBuilder();
int count = 0;
while (file.ready()) {
int data = file.read();
bigS.append((char) data);
}
file.close();
String[] splitFile = bigS.toString().split("\n");
for(String s : splitFile) {
for(String word : words) {
Pattern pattern = Pattern.compile(word);
Matcher matcher = pattern.matcher(s);
while(matcher.find()) count++;
}
if(count == 2) System.out.println(s);
count = 0;
}
}
}