input: Write a function to group strings by their lengths.
  assert group_by_length(['word', 'sentence', 'hello', 'programming']) == {4: ['word', 'hello'], 8: ['sentence'], 11: ['programming']}
  assert group_by_length(['a', 'ab', 'abc', 'abcd']) == {1: ['a'], 2: ['ab'], 3: ['abc'], 4: ['abcd']}
  assert group_by_length(['']) == {0: ['']}
  assert group_by_length(['apple', 'banana', 'cherry', 'date']) == {5: ['apple'], 6: ['banana', 'cherry'], 4: ['date']}
output: def group_by_length(strings):
      result = {}
      for s in strings:
          length = len(s)
          if length in result:
              result[length].append(s)
          else:
              result[length] = [s]
      return result