Python split get last element. Auxiliary space: O(n).