public static String longestSubstringUnrepeatedChar(String inputString) {
		StringBuilder longestSoFar = new StringBuilder();
		String longestSubstringResult = "";
		if (inputString.isEmpty()) {
			return "";
		} else if (inputString.length() == 1) {
			return inputString;
		}
		
		Map<String, Integer> map = new HashMap<String, Integer>();
		for (int i = 0; i < inputString.length(); i++) {
			String currentCharacter = String.valueOf(inputString.charAt(i));
			int idx = longestSoFar.indexOf(currentCharacter);
			if (idx == -1) {
				if (!map.containsKey(currentCharacter)) {
					map.put(currentCharacter, i);
				}
			} else {
				longestSoFar.delete(0, idx+1);
				map.put(currentCharacter, i);
			}
			longestSoFar.append(currentCharacter);
			if (longestSoFar.length() > longestSubstringResult.length()) {
				longestSubstringResult = longestSoFar.toString();
			}
		}
		return longestSubstringResult;
	}