Original: According to the legal theory followed by the Western Allies, the occupation of most of Germany ended in 1949 with the declaration of the Federal Republic of Germany and the German Democratic Republic.
Simplified: According to the western allies, the occupation of most of Germany ended in 1949 when the Federal Republic of Germany and the German Democratic Republic were set up.