This ``challenge'' is a thinly-veiled help thread. OP needed to know how to do it, so he added the ``I bet you can't do it'' to make it seem like more of a challenge than a mere help thread for a rather simple question.
I'm disappointed in you, /prog/. I thought you were better than helping Intro to Comp-Sci students.