Economy rebounds after third-quarter contraction