Task: Program Execution
Input (English): i, 369, Q, M, X, M, 5677, 5747, H
Output (English): 1, 3, 4, 5, 6, 9