Subtracting, the old-fashioned way Overview
Adding slightly to the complexity of working with Roman numerals...
The ancient Romans devised a number system using Latin letters, which served them well, and which is still used by modern civilization, though to a much smaller degree. In the time of its use, Romans would have had to learn to use and manipulate these numbers in order to be of much use for many applications. For example, if a man owned 35 oxen, and he sold 27 of them, how would he know the new total other than counting them all? (Ok, that and using an abacus...) If the Romans could do it, surely we can figure it out as well.

Objective
Write the shortest algorithm/function/program that will subtract two Roman numerals together and output the result without converting the string representation of either input into a number.

Rules/Constraints
Because of historical/pre-medieval inconsistencies in formatting, I'm going to outline some non-standard (per modern usage) rules for orthography. See the value guide below as an example.


Since we are subtracting, negative numbers are permissible. 0s, as they have no representation in the Roman system, should be returned as NULL or an empty string.
The letters I, X, C, and M can be repeated up to four times in succession, but no more. D, L, and V can never be repeated. 
The letter immediately to the right of another letter in the Roman representation will be of the same or lesser value than that to its left. 


In other words, VIIII == 9 but IX != 9 and is invalid/not allowed.

All input values will be 2,000 (MM) or less; no representation for numbers greater than M is necessary.
All input values will be a valid Roman numeral, pursuant to the rules above.
You may not convert any numbers to decimal, binary, or any other number system as part of your solution (you are welcome to use such a method to VERIFY your results).
This is code golf, so shortest code wins.


I do have a solution to this problem that has already been beaten, but I'll hold off on posting it for a few days to see if any other answers come up.

Value Guide  

Symbol        Value
I             1
II            2
III           3
IIII          4
V             5
VIIII         9
X             10
XIIII         14
XXXXIIII      44
L             50
LXXXXVIIII    99
C             100
D             500
M             1,000


Examples

XII - VIII = IIII (12 - 8 = 4)
MCCXXII - MCCXXII = '' (2,222 - 2,222 = 0)
XXIIII - XXXXII = -XVIII (24 - 42 = -18)


If any further clarification is needed, please ask.
sed 144

Most of you will know this little episode from roman times, when Cesar invented the Cesar crypting (aka rot13) using SED. 

As a big fanatic of SED, he printed the most common used commands: substitute, print, quit and read (SPQR) on signs which he carried with him to teach his soldiers the use of SED. 

#  63 = sed-file
#  81 = this
# 144 summa summarum
tac a|rev|sed y/gs/sg/ &gt;b
echo $1|sed -f a|sed "s/$(echo $2|sed -f a)//"|sed -f b


first version 181:

# 126 = 2 sed-files =126
#  55 = this
# 181 summa summarum 
echo $1|sed -f a|sed "s/$(echo $2|sed -f a)//"|sed -f b


2 files to use which count to the solution:

a: 

s/M/DD/g
s/D/CCCCC/g
s/C/LL/g
s/L/XXXXX/g
s/X/VV/g
s/V/IIIII/g


b:

s/IIIII/V/g
s/VV/X/g
s/XXXXX/L/g
s/LL/C/g
s/CCCCC/D/g
s/DD/M/g


but b can be produced with the first line of the new solution from a: it is - more or less - the inverse, and so we read the file from bottom to top (tac) and from right to left (rev), and switch s and g which are now in the wrong order.

Invocation: 

./cg-6061-roman-minus.sh MDCCCCLXV LXVI 
MDCCCLXXXXVIIII


I guess I can golf this further, but I liked to occupy wallstreet the sed slot. :)

Since the logic isn't only in the sed files, but in the invocation too, I sum it all up. It could be argued about echo $1, but what about the nested $2? Let's just sum it together. 

The sedfiles are pretty long and very redundant in their structure. There seems to be room for optimization. 

Luckily, the romans already had QVANTVM &lt;OMPVTVVMZ, so they didn't care for the otherwise lousy performance. 

tl;dr:

I convert both numbers into church numerals (IIIIII=6), remove the second from the first, and reconvert the result back. 

s.e.d. - sod errat demonstrandum.