It is possible that a little more detail would help answer this question. As it stands, I would approach this problem by trying to troubleshoot step-by-step, and here are some steps I would consider.
If you have access to a different Apple or other vendor's USB keyboard, attempt to use that to see if the problem recurs. It is possible that your particular keyboard and/or laptop USB ports have a problem.
I would check your terminal emulation type with:
$ printenv TERM
If it is not "xterm-256color" (the default for new windows in OS X's Terminal) then you may wish to consider setting your window to use that via Terminal's preferences. (This assumes you are using Terminal, and not an alternative, like iTerm.)
If you are using the "screen" utility or an SSH session, you may wish to try the same processes without them. If the problem repeats without them, you've gained some more information. If the problem doesn't repeat, then the configuration for those utilities or the interaction with your shell may be at issue, and you can look further into that.
Your tags indicate that Zsh might be in use. Determine if you have the same problem if you switch to bash (the default for OS X since Mac OS X 10.3 Panther) or another shell. A benefit of trying this that Bash and Zsh shouldn't share any or many configuration files. So, the possibility of a particular customized configuration for either shell being the culprit would be minimized.
If another shell doesn't have the same problem, you will need to determine whether the shell configuration or shell itself is the problem. If the shell you normally use has been customized, I'd back up and eliminate that customization before starting a new session. If the new session works, then it stands to reason there's a problem in your specific shell configuration.
You could also try the above steps with a fresh new OS X user account, which will inherit default settings from the localized user template for your language. This user account can be created and removed after testing via System Preferences > Users & Groups (as it is named in OS X Mountain Lion). This step would generally eliminate any other keyboard layouts that have been installed, as well as software that might modify keyboard behavior. Even if such software was installed for all users on the system, it is probably not set up as a Login Item for new users.