Task: Program Execution
Input (English): 3491 A 5107 W p 7913 E m M O f a n A 3595 Q 815 x 8725 9387 6357 6629 5089 21 X 9635
Output (English): 3491, 1, 5107, 23, 16, 7913, 5, 13, 13, 15, 6, 1, 14, 1, 3595, 17, 815, 24, 8725, 9387, 6357, 6629, 5089, 21, 24, 9635