def run_length_encode(in_array):
if(len(in_array)==<NUM_LIT:0>):<EOL><INDENT>return []<EOL><DEDENT>curr_ans = in_array[<NUM_LIT:0>]<EOL>out_array = [curr_ans]<EOL>counter = <NUM_LIT:1><EOL>for in_int in in_array[<NUM_LIT:1>:]:<EOL><INDENT>if in_int == curr_ans:<EOL><INDENT>counter+=<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>out_array.append(counter)<EOL>out_array.append(in_int)<EOL>curr_ans = in_int<EOL>counter = <NUM_LIT:1><EOL><DEDENT><DEDENT>out_array.append(counter)<EOL>return out_array<EOL>
A function to run length decode an int array.

    :param in_array: the inptut array of integers
    :return the encoded integer array