problem reconstructing a string removing punctuation
<p>I am trying to write a program to strip the punctuation from a string. The input to the program should be a string of characters including punctuation; the output should be a string in which the punctuation is removed. I am using Visual Studio 2008 to compile and run the program. While executing it I am getting exception: "Debug Assertion Failed, Expression: string subscript out of range."</p>

<p>What 
am I doing wrong here?</p>

<pre><code>int main()
{    
    string input;
    string output;

    getline(cin, input);

    string::size_type i = 0;
    for (string::size_type ix = 0; ix != input.size(); ++ix)
    {

        if (!ispunct(input[ix]))
        {
            output[i] = input[ix];
            ++i;
        }

    }


    cout &lt;&lt; output &lt;&lt; endl;

    return 0;
}
</code></pre>
