push the same pairs
if ( arr [ i ] == arr [ i + 1 ] ) : NEW_LINE INDENT arr_pairs . append ( arr [ i ] ) NEW_LINE i += 1 NEW_LINE DEDENT length = arr_pairs [ 0 ] NEW_LINE breadth = arr_pairs [ 1 ] NEW_LINE size = len ( arr_pairs ) NEW_LINE