Hello Batman or Joker fans!! You all know that in the history of movie, one of the smartest villain is Joker. The reason behind of it is Joker always gives brainstorming challenges to the Gotham police as well as Batman.
This time Joker locked up Batman. He gave a string related challenge to Gordon(chief of Gotham police) and asked to find a new string from two original strings. This new string is the password to rescue Batman. Gordon came to you to solve this challenge.
Joker gave two non-empty strings of length and of length . You are supposed to take a prefix of any length (maybe 0) from and a suffix of any length (maybe 0) from . After concatenating and , the new resulting string need to be palindrome. And the length of the determined string should be maximum. If multiple string of same length can be determined then choose lexicographically minimum.
Dare you to take this challenge and rescue Batman?
The first line contains string and the second line contains string .
and consist of lowercase Latin alphabet.
Print the determined string in a single line.