hope u r using licensed and updated antivirus (i prefer avg/kaspersky).. check the following with steps: howevr, did u tried reinstalling the keyboard driver.. or replacing the keyboard with a standby.. remove the mouse n see.. try reinstalling the os.. sometime it happens, if ur ram is faulty.. the last option left is ur main/mother board.. seek professional advice of ur system admin/vendor....
Just check the program settings you're using. Depending on the program, it will be under tools, options, or preferences. You could have 1 1/2 or double space set for default. Don't press enter at the end of the sentences. Find the ¶ character on the control buttons. This will show ALL functions. Spaces will appear as a high dot •. Tabs will appear as an arrow →, and enter will show up as ¶.
If you are typing and the cursor jumps back and inserts letters into something you have typed, you are hitting the mousepad and causing your typing to go back to where the cursor is. Try taping a square cut from a cereal box, over the mousepad and see if it stops it.