Cody

Solution 1485875

Submitted on 10 Apr 2018 by Sergey Kasyanov
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 'XIX'; y_correct = 19; assert(isequal(roman(x),y_correct))

a = 'XIX' 'I' [1] [-1] 'X' [10] [10]

2   Pass
x = 'IV MMXII LIV'; y_correct = [4 2012 54]; assert(isequal(roman(x),y_correct))

a = 'IV' 'I' [1] [-1] a = 'MMXII' 'I' [1] [1] 'X' [10] [10] 'M' [1000] [1000] 'M' [1000] [1000] a = 'LIV' 'I' [1] [-1] 'L' [50] [50]

3   Pass
x = 'MDCCCCX MCMIII MCMX'; y_correct = [1910 1903 1910]; assert(isequal(roman(x),y_correct))

a = 'MDCCCCX' 'C' [100] [100] 'C' [100] [100] 'C' [100] [100] 'C' [100] [100] 'D' [500] [500] 'M' [1000] [1000] a = 'MCMIII' 'I' [1] [1] 'I' [1] [1] 'M' [1000] [1000] 'C' [100] [-100] 'M' [1000] [1000] a = 'MCMX' 'M' [1000] [1000] 'C' [100] [-100] 'M' [1000] [1000]

4   Pass
x = 'MDCCCCLXXXXVIIII MCMXCIX MIM'; y_correct = [1999 1999 1999]; assert(isequal(roman(x),y_correct))

a = 'MDCCCCLXXXXVIIII' 'I' [1] [1] 'I' [1] [1] 'I' [1] [1] 'V' [5] [5] 'X' [10] [10] 'X' [10] [10] 'X' [10] [10] 'X' [10] [10] 'L' [50] [50] 'C' [100] [100] 'C' [100] [100] 'C' [100] [100] 'C' [100] [100] 'D' [500] [500] 'M' [1000] [1000] a = 'MCMXCIX' 'I' [1] [-1] 'C' [100] [100] 'X' [10] [-10] 'M' [1000] [1000] 'C' [100] [-100] 'M' [1000] [1000] a = 'MIM' 'I' [1] [-1] 'M' [1000] [1000]