Skip to main content
Commonmark migration
Source Link

Brachylog, 4 bytes

@2tr

Try it online!

###Explanation

Explanation

@2        Split in half
  t       Take the second half
   r      Reverse it

If the input has odd length, the second half generated by @2 is the one that is the longest, that is the one we should return (after reversing it).

Brachylog, 4 bytes

@2tr

Try it online!

###Explanation

@2        Split in half
  t       Take the second half
   r      Reverse it

If the input has odd length, the second half generated by @2 is the one that is the longest, that is the one we should return (after reversing it).

Brachylog, 4 bytes

@2tr

Try it online!

Explanation

@2        Split in half
  t       Take the second half
   r      Reverse it

If the input has odd length, the second half generated by @2 is the one that is the longest, that is the one we should return (after reversing it).

Source Link
Fatalize
  • 39.3k
  • 5
  • 70
  • 162

Brachylog, 4 bytes

@2tr

Try it online!

###Explanation

@2        Split in half
  t       Take the second half
   r      Reverse it

If the input has odd length, the second half generated by @2 is the one that is the longest, that is the one we should return (after reversing it).