AF = Midway – USA gets warning of Midway attack by working out that AF = Midway
The Apple (A) and Frog (F) couldn't tug past the Midway point (Battle of Midway).
The U.S. Navy radio intelligence organisation known as OP-20-G was key to Americans' victory in the Battle of Midway. The Japanese used a secret code for sending messages called JN-25. Breaking the code called for complex mathematical analysis.
In the spring of 1942, intercepted Japanese messages began to make reference to an impending operation in which the objective was referred to as "AF". The U.S. codebreakers guessed that this referred to Midway – but they had to be absolutely certain.
To remove any doubt, in mid-May 1942 the commanding officer of the Midway installation was told to send a message indicating that the installation's water distillation plant had suffered serious damage and that fresh water was needed immediately.
Soon after transmission of the message, an intercepted Japanese report indicated that "AF is short of water". The Americans also discovered the date of the planned Japanese attack.
Armed with this information, the Americans moved their aircraft carriers to a position northeast of Midway, where they would lie in wait. They were now in a position to stage an ambush on any arriving Japanese ships.
Interesting fact: If OP-20-G had not discovered in advance the site of the planned Japanese attack, the American carriers would have been 3000 miles away when it happened.