```
if(s.length()==0)
return 0;
int length = s.length();
int l[length] = {0};
int g[length] = {0};
l[0] = 1;
g[0] = 1;
for(int i=1;i<length;i++)
{
l[i]=0;
for(int j = i;j>=0;j--)
{
vector<int> arr(256,0);
if(arr[s[j]]==0)
{
arr[s[j]]++;
l[i]++;
}
else
{
break;
}
}
g[i] = max(g[i-1],l[i]);
}
return g[length-1];
```