ah, that's because you initialized result to 0. you would need it to start out as an empty string if you wanted to use this technique (which I think you should)