this problem broaden its test set,so that we should use sign[xxxx]-'a' two record;
and when we calculate the length, we should test j-i+1;
class Solution {
public:
int lengthOfLongestSubstring(string s) {
int sign[300]={0};
int i = 0;
int j = 0;
int max = 0;
for(i = 0,j = 0;j<s.length();j++)
{
while(sign[s[j]-' '] == 1)
{
sign[s[i]-' '] = 0;
i++;
}
sign[s[j]-' '] = 1;
if(j-i +1> max)
max = j-i+1;
}
return max;
}
};