For this Question: Given two strings 'str1' and 'str2', check whether both of these strings are beautiful or not.
Two strings str1 and str2 are called beautiful if there is a one-to-one mapping possible for every character of str1 to every character of str2 while preserving the order.

<b>Note</b>: All occurrences of every character in str1 should map to the same character in str2First line contain a string str1. Second line contain a string str2.

<b>Constraints:</b>
1 <= |str1|, |str2| <= 2*10^4Print "Yes" if str1 and str2 are beautiful otherwise print "No".Sample Input 1:
ppqrr
ffghh

Sample Output 1:
Yes

Explanation:
Given strings are Beautiful among each other.
There a three different strings in str1 and str2 with equal frequency.
str1
p : 2 
q : 1
r : 2
Similarly str2 having 
f : 2
g : 1
h : 2, I have written this Solution Code: import java.io.IOException;
import java.util.Arrays;
import java.util.*;


public class Main {
    
    public static void main(String[] args)throws IOException {
        Scanner sc=new Scanner(System.in);
        int tc =1;
        while(tc-->0)
        {
            String s1 = sc.nextLine();
            String s2 = sc.nextLine();
            
            Solution obj = new Solution();
            
            boolean a = obj.areBeautiful(s1,s2);
            if(a)
            System.out.println("Yes");
            else
            System.out.println("No");
        }
    }
    
}
// } Driver Code Ends


class Solution
{
    //Function to check if two strings are isomorphic.
    public static boolean areBeautiful(String str1,String str2)
    {
        // Your code here
         if(str1.length() != str2.length()){
           return false;
       }
       HashMap<Character,Character> map = new HashMap<>();

       for (int i = 0; i < str1.length(); i++) {
           if(!map.containsKey(str1.charAt(i))){
               if(map.containsValue(str2.charAt(i))){
                   return false;
               }
               map.put(str1.charAt(i),str2.charAt(i));
           }
           else {
               char val = map.get(str1.charAt(i));
               if(val != str2.charAt(i)){
                   return false;
               }
           }
       }

return true;        
        
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?