Task: Program Execution
Input (English): matter, G, both, D, L, Q
Output (English): matterGbothDLQ