input: Write a python function to compress a string using run-length encoding.
  assert compress("aabcccccaaa") == "a5b1c5"
  assert compress("abcd") == "a1b1c1d1"
  assert compress("aaabb") == "a3b2"
output: def compress(s):
      if not s:
          return ""
      
      compressed = []
      count = 1
      
      for i in range(1, len(s)):
          if s[i] == s[i - 1]:
              count += 1
          else:
              compressed.append(s[i - 1] + str(count))
              count = 1
      
      compressed.append(s[-1] + str(count))
      return ''.join(compressed)