To check the permutation just check if both have same no. of variables and frequency or Sort the both the string and iterate them if any of them find to be different return false