That's extremely odd behavior. Did this problem happen suddenly? Do you recall what you did prior to it happening (like opening an e-mail attachment or visiting a new website)? First, before any other troubleshooting, make sure your anti-virus is up to date and run a malware scan (e.g. MalwareBytes). If it's not a virus, it may be due to a fault with the keyboard
driver. Perhaps you have an older laptop and a recent Windows update created a conflict? You could also try going to the Device Manager, select your keyboard, and then check to see if there's a driver update.