"To swap the two words: Given a string consisting of exactly two words separated by a space. Print a new string with the first and second word positions swapped (the second word is printed first). This task should not use loops and if. " - Snakify python coding question

 



 

CODING QUESTION

Given a string consisting of exactly two words separated by a space. Print a new string with the first and second word positions swapped (the second word is printed first).

This task should not use loops and if.


SOLUTION

s=str(input())
print(s[s.find(' ')+1:],s[:s.find(' ')])

 

Input : Hello, world!

Output : world! Hello,