BARCELONA, Spain (AP) — After four difficult years, Hungarian swimmer Katinka Hosszu is going to have a golden wedding.

A month before she marries her coach, Hosszu downright dominated the 400-meter individual medley at the world championships Monday, winning by nearly 1 1/2 seconds and relegating Olympic champion Ye Shiwen of China to fourth.

It was quite a turnaround from a year ago, when Ye stunned the field as a 16-year-old and Hosszu finished last in the final.

Or from the 400 IM at the London Games, when Hosszu placed fourth.

Or the 2011 worlds in Shanghai, when Hosszu also went medal-less.

In fact, Hosszu hadn't won a medal at a full international championship since she took home one gold and two bronzes from the 2009 worlds in Rome.

"I haven't been on top since 2009," she said. "It's really great to be back."

Hosszu is the latest in a long line of strong medley swimmers from Hungary.

Tamas Darnyi swept all four IM golds at the 1988 Seoul and 1992 Barcelona Games. Attila Czene won the 200 IM at Atlanta in 1996. On the women's side, Krisztina Egerszegi won five IM golds between 1988 and 1996.

More recently, Laszlo Cseh took silver in both the 200 and 400 IM behind Michael Phelps at the 2008 Beijing Games.

"This is a big win in Hungary," she said.

In August, Hosszu will marry her American coach, Shane Tusup. She started training under him five years ago but then enrolled at the University of Southern California, where she swam under Dave Salo.

She graduated last year and moved back to Hungary after the Olympics to train fulltime under Tusup.

"The past year has been great," Hosszu said. "We've been racing a lot and training lot — a lot more than I had been. I don't have school now, so I have a lot of free time to spend in the pool. And it's paying off."

It's been quite a change from last year, which was a complete whirlwind for Hosszu.

In 2012, Hosszu raced in college as USC team's captain, graduated, then won three golds and a silver at the European Championships, which were held on home ground in Debrecen, Hungary.

All the events meant that she was constantly flying back and forth between California and Hungary.

"That was a pretty crazy year," Hosszu said. "Then I got to the Olympics and I was like, 'Oh my gosh, so much has happened this year.' It seemed like five years."

Now, it's just her and Tusup.

"It's great that I have someone who is working only with me," Hosszu said. "All the practices we know what I need and what I need to do."

It certainly appeared that way in this race.

Hosszu led from start to finish and was so far ahead entering the final 50 meters that she couldn't even see any of her rivals, touching the wall in 2 minutes, 7.92 seconds.

"I was like, 'What's going on? Did they stop the race?'" Hosszu said. "But I just wanted to get the wall and start celebrating, so the last 50 meters seemed like forever."

Hosszu is entered in six events at these championships, although she withdrew from the 100 backstroke semifinals Monday to focus on the IM despite qualifying second behind American teenager Missy Franklin.

Ye also won the 400 IM in London, with a world record, but Hosszu now appears the favorite for that race.

"I've been a 400-IMer my whole life, so I don't want to say that I'm expecting to win. Because whatever happens after this gold is just a bonus," Hosszu said, before running off to embrace her coach — and future husband.