input: Write a function to find the length of the longest contiguous segment of equal elements.
  assert solve([1, 1, 2, 2, 2, 3, 3])==3
  assert solve([4, 4, 4, 4, 4, 4])==5
  assert solve([1, 2, 3, 4, 5])==0
output: def solve(arr):
      if not arr:
          return 0
      max_len = 1
      current_len = 1
      for i in range(1, arr.length):
          if arr[i] == arr[i - 1]:
              current_len += 1
              max_len = max(max_len, current_len)
          else:
              current_len = 1
      return max_len