Have you tried another keyboard? I've heard of this problem before, but never heard of a definitive solution.
Replacing the keyboard works for some, others have had to go to a full re-install of Windows in order to fix the issue (I'm sure the problem in that instance could be isolated, but it takes time).
Navigate to "languages" via control panel and look under "installed services" or "installed languages". Anything that is not your country or language (so, "US" or "English) I would remove and see if that fixes the issue. You can always reinstall other packs etc later.
A virus is unlikely (but not impossible), keyboard functions are more difficult to affect with malware than some other functions - it would be strange that the keyboard alone would be a target.
Since you've been visiting torrent sites (and I'm assuming downloading torrents, not just visiting the site for a look), ensure your malware/spyware/general virus protection is good quality. Personally I use the free versions of AVG and Malwarebytes as a bit of "dual protection", but then again, I don't have any huge worry for corrupt data and don't find clean installing the OS too much of a hassle - there may be more 'thorough' protection available as a paid program, you;'d just have to read reviews etc and ensure the protection is what you're looking for.