How do I correct this vector<string> insert.
I am geeting segmintation dump.
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
//#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
struct str{
int go(vector<string> s){
vector<string>::iterator vsitr0;
vector<string>::iterator vsitr1;
vector<string> vs;
int ret = 0;
int count = 0;
for(vsitr0 = s.begin(); vsitr0 != s.end() - 1; ++vsitr0){
count = 0;
for(vsitr1 = s.end() - 1; vsitr1 != vsitr0; --vsitr1){
if(*vsitr0 > *vsitr1){
count++;
// HERE IT IS/////
s.insert(vsitr1, *vsitr0);
///////////////////////////////
}
}
if(count > 0) ret++;
}
return ret;
}
//////
};
int main() {
vector<string> s;
s.push_back("Aaa");
s.push_back("Ppp");
s.push_back("C is cool");
s.push_back("Apple");
str m;
int ans = 0;
ans = m.go(s);
cout << ans << endl;
}