C++11 primer 5edition page 166 excese practice

As the title,here is the code for the practice,the program should do as follows:
if you input: we we how how how cow cow you,it show cout---how :3,here is my code,may someone can help me? T T

#include <iostream>
#include <string>
#include <vector>



using namespace std;
using std::vector;

int main(){
vector<string> vec1={"hello","hello","wo","me"};
int i,j=0;
auto beg1=vec1.begin();
auto end1=vec1.end();
auto ptr=beg1;
auto ptr1=ptr;

while (ptr!=end1) {
for(i=1;*(ptr)==*(ptr+1);++ptr){
i+=1;
}
if(j<i){
j=i;
ptr1=ptr;
}
ptr += 1;
}
}
Please type your question better. It is not clear what you are trying to ask.
Use the buttons to the right of the text box to surround code and sample input output like this:
1
2
//this is code
void lalala() {}

sample input/output
Topic archived. No new replies allowed.