Task: Program Execution
Input (English): 2, 5, ['p', 'P', 'X', 'd', 'A']
Output (English): AdXP