Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.regex.Matcher;
  3. import java.util.regex.Pattern;
  4.  
  5. public class Task1102 {
  6. public static void main(String[] args) {
  7.  
  8. Scanner scanner = new Scanner(System.in);
  9. Integer nInput = Integer.parseInt(scanner.nextLine());
  10.  
  11. for (int i = 0; i < nInput; i++) {
  12.  
  13. String input = scanner.nextLine();
  14. if (checkDialogue(input)) System.out.println("YES");
  15. else System.out.println("NO");
  16. }
  17. }
  18.  
  19. public static boolean checkDialogue(String input) {
  20.  
  21. String methodInput = input;
  22. String[] regex = {"outputone","inputone","outputon","inputon","output","out","input","in","one","puton"};
  23.  
  24. for (int i = 0; i < regex.length; i++) {
  25. methodInput.replaceAll(regex[i]," ");
  26. }
  27. methodInput = methodInput.trim();
  28.  
  29. if (methodInput.length() == 0) return true;
  30. else return false;
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement