Stop Sprint if S key is pressed

Hi, I’m an artist new to game development. I’m facing an issue and couldn’t find any solutions online. I’ve created a simple third-person character that can sprint only when the “W” key is pressed, and I’ve got that working. However, when I’m sprinting and press other keys like “A,” “S,” or “D,” the character changes direction. While “A” and “D” are not a problem, when I press “S,” the character completely changes direction and starts running in the opposite direction. How can I make the character stop sprinting when “S” is pressed?