Domanda di colloquio di Arista Networks

Check if a string is a palindrome string and if not reverse it.