first and second made of lowercase English letters. Check whether second can be obtained by rearranging the letters of first: every letter must occur the same number of times in both strings.
Return True if it can, and False otherwise.
Food for thought: what would change if the strings could hold any Unicode characters?first="listen", second="silent" → True
Both words use the same six letters, just in a different order.
first="banana", second="bandana" → False
The second word has one letter more, so no rearrangement can work.
first="tool", second="loot" → True
first="listen", second="silent"
True
Run checks the first 3 tests in your browser. Submit checks all 89 tests on the server, hidden ones included.