(CNN) When hurtling through the cosmos, the last thing an astronaut wants to worry about is what to do when nature calls.

If they're in a regularly pressured spacecraft, the answer is easy -- just go to the bathroom. And for those hours-long spacewalks, NASA equips astronauts with special adult diapers to mop up any leaks.

But what if they're stuck in a spacesuit for days on end? Not so easy.

What happens to your body in space?

What happens to your body in space? 04:58

What happens to your body in space?

NASA has taken steps to address the problem and recently announced the winner of the Space Poop Challenge , a competition organized by its NASA Tournament Lab (NTL), hosted by the HeroX crowdsourcing initiative.

The winner of the prize was Thatcher Cardon, a family physician, Air Force officer and flight surgeon, whose system "MACES Perineal Access & Toileting System (M-PATS)," who utilized his knowledge of keyhole surgery to develop his design.

The competition was aimed at finding a safe, medically sound solution from taking waste away from astronauts' bodies if confined for a long period of time.

"The challenge sought solutions for fecal, urine, and menstrual management systems for the crew's launch and entry suits over up to 144 continuous hours, or six days," according to a NASA press release.

Veteran astronaut Richard Mastracchio outlined the issue even more succinctly.

"As humans push beyond low Earth orbit, travel to the moon and Mars, we will have many problems to solve -- most of them complex technical problems," he says in an introduction video for the project.

"But some are as simple as, 'How do we go to the bathroom in space?'"

Longer-term solution needed

Currently, if there's an emergency, crews can return to Earth fairly quickly, mainly because they don't currently go that far from the planet's surface.

JUST WATCHED Swedish group asks NASA to send condom to space Replay More Videos ... MUST WATCH Swedish group asks NASA to send condom to space 01:14

But NASA is gearing up for spaceflight beyond the moon, and should an emergency take place far from the safety of Earth, future astronauts may need to wear suits for days, meaning they need to be self-sufficient in terms of air, water, nutrients and waste management -- should space poop have contact with the astronaut for too long it could result in infection or sepsis.

More than 5,000 proposed solutions from a total of 19,000 registered competitors from over 150 teams from "every country and continent on Earth (including Antarctica) participated, according to a press release.

"I never thought that keeping the waste in the suit would be any good," the winner Cardon, told NPR . "So I thought, 'How can we get in and out of the suit easily?'

"I mean, they can even replace heart valves now through catheters in an artery. So it should be able to handle a little bit of poop!"

His design features a tiny airlock in the suit's crotch, through which items such as catheters and inflatable bedpans could be passed through.

"The Space Poop Challenge was a great opportunity to combine his love of solving problems and creating things with his background in aerospace medicine," his HeroX profile page says.

Relief for winners

Three winners will receive a combined total of $30,000, with Cardon taking home half of the total prize money.

JUST WATCHED Space travel altered Kelly's chromosomes Replay More Videos ... MUST WATCH Space travel altered Kelly's chromosomes 00:57

Team Space Poop Unification of Doctors (SPUDs), with its "Air-powered Spacesuit Waste Disposal System," and Hugo Shelley's "SWIMSuit - Zero Gravity Underwear for 6 Day Use" were the runners-up.

"It was invigorating to see the number of people interested and engaged in the challenge," NASA spacesuit engineer Kirstyn Johnson said. "From here, we'll be able to use aspects of the winning designs to develop future waste management systems for use in the suit."

The design could have more terrestrial applications, too.

"I imagine the medical field can make great use of a garment or a device that safely moves waste away from a bed-ridden patient," Mastracchio said.