For this Question: There are n houses evenly lined up on the street, and each house is beautifully painted.

Given an array of house colors, find the maximum distance between two houses with different colors. The distance between two houses is the absolute difference between their indices. 

For example, if the ith house and the jth house have different colors, the distance between them is abs(i- j). 

Constraints:

1)Lenght of the list should be greater than 2 and less than 100
2)List elements should be in the range of 0 to 100
3)List should not have all the same elements (eg: 1 1 1)

If the above constraints are not met, then Print("Invalid input")A List of Integers separated by space, which represents the houses with different colors.The output should be an integer representing the maximum distance between two houses with different colors.Sample1:
Input: 
1 1 1 6 1 1 1
Output: 
3

Explanation: 
In the above sample, consider color 1 as a blue house, and color 6 as a red house.
The furthest two houses with different colors are
House[0] has color 1(blue house), and House[3] has color 6(red house). 

The distance between them is abs(0 - 3) = 3.

Sample2:
Input: 
1 1 1 
Output: 
Invalid input

Sample3:
Input: 
101 102 103
Output: 
Invalid input

Sample4:
Input: 
1
Output: 
Invalid input , I have written this Solution Code: def maxDistance(A):
    if len(A) < 2 or len(A) > 100: # edge case: list length outside range
        print("Invalid input")
        return
    elif any(x < 0 or x > 100 for x in A): # edge case: elements outside range
        print("Invalid input")
        return
    elif all(x == A[0] for x in A): # edge case: list with same elements
        print("Invalid input")
        return
    
    res = 0
    for i, x in enumerate(A):
        if x != A[0]:
            res = max(res, i)
        if x != A[-1]:
            res = max(res, len(A) - 1 - i)
    
    print(res)

A = [int(item) for item in input("").split()]
maxDistance(A), In this Programming Language: Python, Now tell me if this Code is compilable or not?