=====Problem Statement=====
You are given a string, and you have to validate whether it's a valid Roman numeral. If it is valid, print True. Otherwise, print False. Try to create a regular expression for a valid Roman numeral.

=====Input Format=====
A single line of input containing a string of Roman characters.

=====Output Format=====
Output a single line containing True or False according to the instructions above.

=====Constraints=====
The number will be between 1 and 3999 (both included).

Difficulty: introductory

Starter code:

regex_pattern = r""	# Do not delete 'r'.

import re
print(str(bool(re.match(regex_pattern, input()))))

Solutions:
# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
def my_func(s):
    s = s.upper()
    ##res=re.match(r'^(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$',s)
    res=re.search(r'^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$',s)
    if(s=="MMMM"):
        print("False")
    else:
        if res:
            print("True")
        else:
            print("False")
my_func(input())