In Harry Potter and the Goblet of Fire, Harry finds out several weeks before the second task of the Triwizard Tournament that he would be required to survive underwater for an hour.
Harry, Hermione, and Ron all proceed to spend hours and hours researching a solution to this problem, even engaging the librarian's help:
So Harry, thinking that he would soon have had enough of the library to last him a lifetime, buried himself once more among the dusty volumes, looking for any spell that might enable a human to survive without oxygen. However, though he, Ron and Hermione searched through their lunchtimes, evening and whole weekends -- though Harry asked Professor McGonagall for a note of permission to use the Restricted Section, and even asked the irritable, vulture-like librarian, Madam Pince, for help -- they found nothing whatsoever that would enable Harry to spend an hour underwater and live to tell the tale.
Goblet of Fire -- Bloomsbury -- chapter 26, The Second Task
Hermione, in particular, has a charm in mind as the most probable solution:
"I think your best chance is some sort of charm."
Hermione -- Goblet of Fire -- Bloomsbury -- chapter 26, The Second Task
Despite many hours spent searching, and despite Hermione's formidable researching skills, they are unable to find any solution.
However, in the second task itself, both Cedric Diggory and Fleur Delacour use a Bubble-Head Charm to survive underwater:
Miss Fleur Delacour, though she demonstrated excellent use of the Bubble-Head Charm, was attacked by Grindylows as she approach her goal, and failed to retrieve her hostage.
...
Mr Cedric Diggory, who also used the Bubble-Head Charm, was first to return with his hostage, though he returned one minute outside the time limit of an hour.
Goblet of Fire -- Bloomsbury -- chapter 26, The Second Task
The Bubble-Head Charm doesn't appear to be particularly difficult to perform, as it is in widespread usage among students by Harry's fifth year:
Dungbombs and Stink Pellets were dropped so frequently in the corridors that it became the new fashion for students to perform Bubble-Head Charms on themselves before leaving lessons, which ensured them a supply of fresh air, even though it gave them all the peculiar appearance of wearing upside-down goldfish bowls on their heads.
Order of the Phoenix -- Bloomsbury -- chapter 30, Grawp
Why did Harry, Hermione, and Ron all fail to discover the Bubble-Head Charm in advance of the second task, despite spending weeks specifically researching a charm to survive underwater, and despite both Cedric and Fleur learning that charm?