package yukiCoder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00069 { public static void main(String[] args) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); try { String input1 = bufferedReader.readLine(); String input2 = bufferedReader.readLine(); System.out.println(isEqual(input1, input2) ? "YES" : "NO"); } catch (IOException e) { e.printStackTrace(); } } public static Boolean isEqual(String input1 , String input2) { String[] indexArray = new String[input1.length()]; for(int i = 0 ; i < input2.length() ; i++) { String input2Digit = String.valueOf(input2.charAt(i)); for(int j = 0 ; j < input1.length() ; j++) { String input1Digit = String.valueOf(input1.charAt(j)); if(indexArray[j] == null && input1Digit.equals(input2Digit)) { indexArray[j] = input1Digit; break; } } } StringBuilder builder = new StringBuilder(); for (int i = 0 ; i < indexArray.length ; i++) { builder.append(indexArray[i]); } return input1.equals(builder.toString()) ? true : false; } }