Obama wins a second term as U.S. president