input: Write a function to determine if a given number has an undulating pattern.
  
  assert is_undulating("1212121") == True
  assert is_undulating("1991") == False
  assert is_undulating("121") == True
output: def is_undulating(s: str) -> bool:
      if len(s) < 2:
          return False
      first, second = s[0], s[1]
      if first == second:
          return False
      for i in range(2, len(s)):
          if s[i] != s[i % 2]:
              return False
      return True