var lengthOfLongestSubstring = function (s) {
var max = 0;
var i = 0;
var j = 0;
var n = s.length;
var map = {};
while (i < n && j < n) {
if (map[s[j]] === undefined) {
map[s[j]] = 1;
j++;
max = Math.max(max, j - i);
} else {
delete map[s[i]];
i++;
}
}
return max;
};
def length_of_longest_substring(s)
max = 0
for i in 0..s.length-1
check = Array.new(256, false)
for j in i..s.length-1
index = s[j].ord
if check[index] == false
check[index] = true
else
break
end
end
if check.count(true) > max
max = check.count(true)
end
end
max
end