input: Write a function to find the longest subsequence of identical elements in an array.
  assert longestSubsequence([1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4])==[3, 3, 3, 3]
  assert longestSubsequence([1, 2, 3, 4, 5])==[1]
  assert longestSubsequence([5, 5, 5, 5, 5])==[5, 5, 5, 5, 5]
  assert longestSubsequence([1, 2, 2, 3, 3, 3, 2, 2])==[3, 3, 3]
output: def longestSubsequence(arr):
      if not arr:
          return []
      
      max_len = 1
      current_len = 1
      longest_seq = [arr[0]]
      current_seq = [arr[0]]
      
      for i in range(1, len(arr)):
          if arr[i] == arr[i-1]:
              current_len += 1
              current_seq.append(arr[i])
          else:
              if current_len > max_len:
                  max_len = current_len
                  longest_seq = current_seq
              current_len = 1
              current_seq = [arr[i]]
      
      if current_len > max_len:
          longest_seq = current_seq
      
      return longest_seq