Refactoring code of RomanNumeric problem