ContraSolver: Self-Alignment of Language Models by Resolving Internal Preference Contradictions