Compares two strings and checks if one is a permutation of the other