def romaine_v2(string):
    """
    (str) -> (bool or int)
    Converts roman numerals to arabic numerals without using string methods.
    Restrictions: String must strictly consist of any one of M, D, C, X, V, and
    I. Anything else (such as trailing whitespaces) will return False.
    """

    total = 0

    for y in string:

        if y == 'm' or y == 'M':
            total += 1000
        elif y == 'd' or y == 'D':
            total += 500
        elif y == 'c' or y == 'C':
            total += 100
        elif y == 'x' or y == 'X':
            total += 10
        elif y == 'v' or y == 'V':
            total += 5
        elif y == 'i' or y == 'I':
            total += 1
        else:
            return False

    return total