public static int findLongestSubWithoutRep(String s) {
		if (s.length() == 0) {
			return 0;
		}
		char[] arr = s.toCharArray();
		int i = 0;
		int maxlength = 1;
		int begin = 0;
		int tempLen = 0;
		int tempBegin = 0;
		HashSet<Character> hs = new HashSet<Character>();
		while (i < arr.length) {
			if (!hs.contains(arr[i])) {
				hs.add(arr[i]);
				tempLen += 1;
				if (tempLen > maxlength) {
					maxlength = tempLen;
					begin = tempBegin;
				}
			} else {
				hs.clear();
				tempBegin = i - tempLen + 1;
				i = i - tempLen + 1;
				hs.add(arr[i]);
				tempLen = 1;
			}
			i++;
		}
		return maxlength;
	}