I\'m trying to detect a pattern that has three parts:
I
Make last space optional:
sed 's/[ ]\([mt][ ]\?\)$/\1/' input
Posix friendly version:
sed 's/[ ]\([mt][ ]\{,1\}\)$/\1/' input