A coping mechanism is a strategy used to deal with or resolve problems by replacing or suppressing unwanted thoughts or feelings with more acceptable alternatives. This can be achieved through various techniques, such as meditation, distraction, or cognitive restructuring.