you need to initialize variable s and b, because they get garbage when you declare them
you can check this by using the debugger
What do you mean by "doesn't work"? Actually it works from begin to end. But result is quite unpredictable because you use uninitialized variable s.