Worst case - quadratic complexity.
loop ( liniar complexity ); 
*
std::string::erase ( liniar complexity )
~
O( n^2 )