For Germany, this article provides the answer. For Japan, it's a little different, of course, but the principle of judiciously using post-war investment holds for Japan too.
This should be more common knowledge and hopefully it will stop the rumors like "Germany was flattened so they could start from a blank slate". This obviously holds no water as this advantage would have been entirely eroded within 10-20 years as new technologies came in anyway.
The UK squandered Marshall Aid. The UK squandered North Sea oil revenue. The UK ripped up and threw away an advantageous membership of the world's largest free trade bloc.
The UK has an unenviable track record in this area.