you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 1 year ago (1 child)
public static int convertRomanNumeral(String numeral)
{
  numeral = numeral.replace("M", "DD")
    .replace("CD", "CCCC")
    .replace("D", "CCCCC")
    .replace("C", "LL")
    .replace("XL", "XXXX")
    .replace("L", "XXXXX")
    .replace("X", "VV")
    .replace("IV", "IIII")
    .replace("V", "IIIII");
  return numeral.length();
}
  • source
  • parent
  • hideshow 1 child comment
  • [–] [S] 7 points 1 year ago
    public static int convertRomanNumeral(String numeral)
    {
      return numeral.replace("M", "DD")
        .replace("CD", "CCCC")
        .replace("D", "CCCCC")
        .replace("C", "LL")
        .replace("XL", "XXXX")
        .replace("L", "XXXXX")
        .replace("X", "VV")
        .replace("IV", "IIII")
        .replace("V", "IIIII")
        .length();
    }
    
  • source
  • parent