/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template */ package test; import java.util.*; import java.io.*; /** * * @author GIGABYTE */ public class Test { /** * @param args the command line arguments * @throws java.io.IOException */ static class ob{ String sys,full, first, last; public ob(String name){ sys=""; full = name; String[] s = name.split("\\s+"); first = s[0]; last = s[s.length -1]; for (String item : s) { sys += item.charAt(0); } }; public boolean suit(String s){ String[] a = s.split("['.']"); if(a.length != sys.length()) return false; for(int i=0;i a = new ArrayList<>(); sc.nextLine(); for(int i=0;i { if(x.last.compareTo(y.last) == 0) return x.first.compareTo(y.first); return x.last.compareTo(y.last); }); int q = sc.nextInt(); while(q-->0){ String s = sc.next(); for(int i=0;i