input: Write a function to replace all spaces in a given string with underscores, and if a string has more than 2 consecutive spaces, then replace all consecutive spaces with -.
  assert fix_spaces("Example") == "Example"
  assert fix_spaces("Mudasir Hanif ") == "Mudasir_Hanif_"
  assert fix_spaces("Yellow Yellow  Dirty  Fellow") == "Yellow_Yellow__Dirty__Fellow"
  assert fix_spaces("Exa   mple") == "Exa-mple"
  assert fix_spaces("   Exa 1 2 2 mple") == "-Exa_1_2_2_mple"
  
output: def fix_spaces(s):
      result = []
      i = 0
      while i < len(s):
          if s[i] == ' ':
              count = 0
              while i < len(s) and s[i] == ' ':
                  count += 1
                  i += 1
              if count > 2:
                  result.append('-')
              else:
                  result.append('_' * count)
          else:
              result.append(s[i])
              i += 1
      return ''.join(result)