# What's my middle name?

Note: The winning answer will be selected on 4/12/17 the current winner is Jolf, 1 byte.

I'm surprised that we haven't had a what's my middle name challenge on this site yet. I did alot of searching but found nothing. If this is a dup, please flag it as such.

Parse a string that looks like Jo Jean Smith and return Jean.

## Test cases

Input: Samantha Vee Hills
Output: Vee

Input: Bob Dillinger
Output: (empty string or newline)

Input: John Jacob Jingleheimer Schmidt
Output: Jacob Jingleheimer

Input: Jose Mario Carasco-Williams
Output: Mario

Input: James Alfred Van Allen
Output: Alfred Van

(That last one is incorrect technically, but fixing that would be too hard.)

## Notes:

• Names will always have at least 2 space-separated parts, with unlimited middle names between them or can be a list/array of strings.
• Names may contain the alphabet (case-insensitive) and - (0x2d)
• You may output a trailing newline.
• You may require input to have a trailing newline.
• Input from STDIN, a function parameter, or command-line argument is allowed, but hard-coding it in is not allowed.
• Standard loopholes forbidden.
• Output may be function return value, STDOUT, STDERR, etc.
• Trailing spaces/newlines/tabs in the output are allowed.
• Any questions? Comment below!

This is , so the shortest anwser in bytes wins!

• Can the output be a list of strings? – Anthony Pham Apr 2 '17 at 14:34
• If other formats than a space-separated string are allowed, please edit that into the specification. – Martin Ender Apr 2 '17 at 14:46
• @programmer5000: if the input can be a list of strings, how about the output? Is ["John", "Jacob", "Jingleheimer", "Schmidt"] -> ["Jacob", "Jingleheimer"] a valid solution? – nimi Apr 2 '17 at 15:17
• Are leading spaces allowed? – betseg Apr 2 '17 at 15:32
• @DJ Because "Van" isn't his middle name, it's part of his last name. A particularly vexing case is David Lloyd George, whose first name is David and last name is Lloyd George. Any attempt to parse real people's names like this is doomed. In fact, you can't even tell what the first and last names are (think Li Shi). – David Conrad Apr 3 '17 at 2:16

# Clojure, 43 bytes:

Here we read string as an edn data, then choosing its center.

# Or for stdout, 57 bytes:

You can also check it here.

• Is the space in str " necessary? – Jonathan Frech Dec 14 '18 at 16:50
• @JonathanFrech it leads to "RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)" without space – bbb1 Dec 14 '18 at 16:55
• @JonathanFrech I add link to online Clojure REPL, so you can check it. UPD: where it works... It's strange. – bbb1 Dec 14 '18 at 16:57
• To me it looks like you changed it in your online REPL, did not change your post and said it would not work ... (TIO). – Jonathan Frech Dec 14 '18 at 17:27

# Pip, 9 bytes

@<@>(a^s)

Slices the first and last names from the string(split on spaces) and prints it.

Try it online!

# Perl 5 + -p040, 13 bytes

$_ x=$.>1&/ /

Try it online!

## Explanation

With -p, input is implicitly stored in $_, the 040 flag makes space the line terminator which means the code is called for each word/name in the input. x= is the in-place string repetition operator which modifies the string in place (e.g.$_="abc";$_ x=3;# "abcabcabc") and the condition is$.>1 ($. is set to the current 'line' number, although since space is our line end character this is word/name number) &ed with / / (if$_ m//atches , which it will for all but the last word/name). Because of -p the result (the string repeated zero or one times depending on the conditional) is implicitly printed.