Depends on how things are characterized. What you could do to solve the problem is to have read the line after the ID up until the carriage return. Then, use a StringTokenizer to separate words by spaces and then use the last word as the type, and combine the rest in order as the word.
So you would read in the ID, then read in the following string:
"obstetrical delivery n"
You would then tokenize it and it would separate into:
s[0] = "obstetrical"
s[1] = "delivery"
s[2] = "n"
So you would do:
type = s[s.length];
StringBuffer word = new StringBuffer("");
for (int i; i < s.length; i++)
word = word + s[i];
Note, the above is pseudo code, don't copy it into your compiler.