Going to the toilet in space isn't easy at the best of times. You're in close quarters, there's little to no gravity, and once all is said and done, where do you store it all?

Now just imagine there's an emergency, and astronauts are stuck in their space suits for days at a time. It's a grim situation that NASA's been thinking about a lot lately, with its mission to Mars on the horizon, and the space agency has turned to the public for help.

NASA has just launched its HeroX competition for inventors to come up with solutions to what it's calling the "space poop" problem, and it's going to award US$30,000 for up to three of the best ideas.

Basically, the conundrum is this: since the Apollo mission ended back in the 1980s, NASA astronauts haven't been further than the International Space Station (ISS) in low-earth orbit.

On board the ISS, astronauts have a toilet device that uses a vacuum to suck up and store urine and faecal matter, so it can either be disposed of safely or recycled as drinking water.

But if there's any kind of accident - say, a crack in the spacecraft that results in a loss of vehicle pressure - astronauts will be confined to their space suits, with no choice but to poop straight into their suits.

If you're travelling to and from the ISS, that's not such a huge deal - within a few hours, the astronauts can be back on Earth to get themselves cleaned up.

But with NASA now looking to send astronauts to Mars in the next 20 years or so, astronauts could be left stranded in their suits for a whole lot longer.

For this reason, NASA's next-generation of suits have been designed to provide "clean air, water, shelter, and enough nutrients for up to six days", or 144 hours, as astronaut Richard Mastracchio explains in this video.

But the space agency doesn't have a way of safely dealing with bodily waste, including urine, faeces, and menstrual blood.

For now, NASA is still using adult 'nappies', which are exactly what they sound like.

As anyone who's changed a baby's nappy will know, more than few hours of sitting in a soiled one can lead to infection and rashes.

And that's here on Earth. In microgravity, once a nappy becomes full, it doesn't take much for the liquid to start travelling around the suit and sticking to other parts of the body.

"The diaper is only a very temporary solution, and doesn't provide a healthy/protective option longer than one day," NASA writes on the competition page. "You don't want any of these solids and fluids stuck to your body for six days."

NASA has now called upon the public to help them come up with a solution to this problem. Some things to keep in mind is that new space suit is very tight, with not a lot of room for a high-tech system.

There's also the issue of microgravity to consider, as well as the fact that the suit needs to remain sealed to protect astronauts from the vacuum of space. And any system you come up with has to be hands-free.

"While sealed, it is impossible for an astronaut to access their own body, even to scratch their nose," says NASA.

If you think you might have what it takes to improve NASA's spacesuit and keep astronauts safe in space, you have until 20 December 2016 to submit your idea.

NASA's goal is to test up to three of the top ideas within a year and fully implement them in the next three years. They'll also award up to three US$30,000 prizes to winners.

It's a pretty great competition - after all, if some of the most talented minds in space engineering can't solve a problem, what better option is there than throwing it at the great collective mind of the public to see what comes back? 

"As humans push beyond low earth orbit and travel to the Moon and Mars, we'll have many problems to solve - most of them very complex technical problems," says Mastracchio.

"But some are as simple as how do we go to the bathroom in space. It isn't glamorous, but it is necessary for survival."

Get brainstorming and submit your ideas by 20 December. Good luck!