import java.util.*; import java.lang.*; import java.io.*; class Ideone{ public static void main(String[] args) throws Exception{ // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); String t = br.readLine(); if(s.length()!=t.length()){ System.out.println("NO"); return; } HashMap map = new HashMap(); for(int i=0;i