Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class Task1102 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- Integer nInput = Integer.parseInt(scanner.nextLine());
- for (int i = 0; i < nInput; i++) {
- String input = scanner.nextLine();
- if (checkDialogue(input)) System.out.println("YES");
- else System.out.println("NO");
- }
- }
- public static boolean checkDialogue(String input) {
- String methodInput = input;
- String[] regex = {"outputone","inputone","outputon","inputon","output","out","input","in","one","puton"};
- for (int i = 0; i < regex.length; i++) {
- methodInput.replaceAll(regex[i]," ");
- }
- methodInput = methodInput.trim();
- if (methodInput.length() == 0) return true;
- else return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement