Keyboards are not expensive to replace. Even for a laptop, you can buy a keyboard which has a USB cable. I have replaced keyboards in past simply because there was too much food debris clogging them and was too much work to clean it all out.
My laptop has a bad key and I use another unused key (there are a few duplicate keys on every keyboard) using a free program from Sharpkeys.