Task: Program Execution
Input (English): 9271, l, r, 3649, w, 6819, C, w, B, 7123, 8913, S, 8941, 1489, a, X, 3951
Output (English): 9271, 12, 18, 3649, 23, 6819, 3, 23, 2, 7123, 8913, 19, 8941, 1489, 1, 24, 3951