Germany's economy contracted by 0.1% in the second quarter, according to data released Wednesday, as demand from the US weakened after a surge in buying.