Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Java 1.0

a guest Apr 4th, 2020 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company.softuni;
  2.  
  3. import java.util.Scanner;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. public class Main3 {
  8.     public static void main(String[] args) {
  9.         Pattern pattern = Pattern.compile("^@#+[A-Z][a-zA-Z0-9]{4,}[A-Z]@#+$");
  10.         Scanner scanner = new Scanner(System.in);
  11.  
  12.         int n = Integer.parseInt(scanner.nextLine());
  13.  
  14.         for (int i = 0; i < n; i++) {
  15.             String line = scanner.nextLine();
  16.             Matcher matcher = pattern.matcher(line);
  17.             if (matcher.matches()) {
  18.                 line = line.replaceAll("\\D+","");
  19.             }
  20.             if (line.isEmpty()) {
  21.                 System.out.println("Product group: 00");
  22.             } else {
  23.                 System.out.println("Product group: " + line);
  24.             }
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top