The rule applies to all input words, regardless of their length or content. However, if the input contains multiple words separated by spaces, the function may not work as expected. For example, if I input "word1 word2 word3", the function may output "word2 word1 word3" instead of "word1 word2 word3".

Please let me know if you would like me to test any additional inputs or if you have any further questions!