Task: Program Execution
Input (English): 6147, J, 3143, 9511, 2103, J, 2657, 9297, S, w, 3393, D, 1039, B
Output (English): 6