public int lengthOfLastWord(String s) {

		char[] chars = s.toCharArray();
		int count = 0;
		int pre = count;
		for (int i = 0; i < chars.length; i++) {
			if (Character.isWhitespace(chars[i])) {
				if (count > 0) {
					pre = count;
				}
				count = 0;
			} else
				count++;
		}
		if (count == 0) {
			return pre;
		} else
			return count;

	}