A museum writes the year on each exhibit in Roman numerals. Help it by turning a whole number into its Roman form.
Roman numerals use seven letters: I is 1, V is 5, X is 10, L is 50, C is 100, D is 500 and M is 1000.
Normally, you write the letters from the biggest value to the smallest, and add their values. For example, 8 is VIII. But six numbers use a different rule. A smaller letter is written just before a bigger one, and its value is subtracted:
IV is 4 and IX is 9.
XL is 40 and XC is 90.
CD is 400 and CM is 900.
Given the number num, return its Roman numeral as a string.
Examples
Example 1:
Input: num = 7
Output: "VII"
Explanation: V is 5, and II is 2.
Example 2:
Input: num = 49
Output: "XLIX"
Explanation: XL is 40, and IX is 9.
Example 3:
Input: num = 2024
Output: "MMXXIV"
Explanation: MM is 2000, XX is 20, and IV is 4.