#include<iostream>
#include<vector>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
class ComboLength
{
public:
int howLong(string moves)
{
vector<int> cc;
int i,j,k=0;
for(i=0;i<moves.size()-1;++i)
{
if(moves[i]==moves[i+1]) //Error
k++;
else
cc.push_back(k);
}
return *max_element(cc.begin(),cc.end());
}
};
I get a segementaion error in line if (moves==moves[i+1])
any idea why?