Treatment of quasi-degeneracy in single-reference coupled-cluster theory. Separation of dynamical and nondynamical correlation effects