Task: Program Execution
Input (English): 6159, Q, 1363, 7169, M, 5367, Q, m
Output (English): 4