R, <s>30</s> <s>27</s> 22 bytes
=
Current solution due to user11599!

    head(scan(,''),-1)[-1]

Takes input from stdin, returns each middle name as a separate string. Returns `character()` in the case of no middle name; that is, a vector of class `character` of length `0`.

**Explanation:**

 Read stdin into a list of strings, separated by spaces

         scan(,'')
Remove the last element. `head` returns the first `n` elements of a list, with `n` defaulting to `6`. If `n` is `-1` it returns all but the last element.

    head(scan(,''),-1)
Now, remove the first element of this list.

    head(scan(,''),-1)[-1]

This yields the middle name(s).