To solve any problem, here are three questions to ask yourself: First, what could I do? Second, what could I read? And third, who could I ask?
1-1. As machines get faster and get more memory, they can handle larger inputs. For poor algorithms, this will eventually lead to disaster.
1-2. A simple and quite scalable solution would be to sort the characters in each string and compare the results. (In theory, counting the character frequencies, possibly using
collections.Counter, would scale even better.) A really poor solution would be to compare all possible orderings of one string with the other. I can't overstate how poor this solution is; in fact, algorithms don't get much worse than this. Feel ...