If the name has a hyphen in it, leave that out. For example, if the last name is Smith-Klein, type Smithliein. If the last name has more than the number of letters the space will allow, then when you get to the last letter the space will allow, stop typing in that box and move on to the next box.
The IRS computers only compare the first four letters of the last name to the SSN anyway, last I was informed on that.