import java.util.Scanner; import java.util.StringTokenizer; import java.io.*; public class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw=new PrintWriter(new OutputStreamWriter(System.out)); static StringTokenizer tokenizer = new StringTokenizer(""); static String next() throws IOException { while ( ! tokenizer.hasMoreTokens() ) { tokenizer = new StringTokenizer(reader.readLine()); } return tokenizer.nextToken(); } static int nextInt() throws IOException { return Integer.parseInt( next() ); } static double nextDouble() throws IOException { return Double.parseDouble( next() ); } public static void main(String[] args) throws IOException { String sell=next(); String buy =next(); int[] sellArr = new int[128]; for (int i = 0; i < sell.length(); i++) { sellArr[sell.charAt(i)]++; } boolean flag = false; int different = 0; for (int i = 0; i < buy.length(); i++) { int index = buy.charAt(i); if (sellArr[index] != 0) { sellArr[index]--; } else { flag = true; different++; } } if (flag) { pw.println("No " + different); } else { pw.println("Yes " + (sell.length() - buy.length())); } pw.close(); } }
标签:不要,tokenizer,到底,int,PTA,next,length,static,new From: https://www.cnblogs.com/liliczw2209/p/17441947.html