Optimal Energy Decay in a One-Dimensional Wave-Heat-Wave System