public int lengthOfLastWord(String s) {

		int n = s.length() - 1;
		//boolean flag = false;
		int len = 0;
		// elimate the space at the end
		while(n>=0&&s.charAt(n)==' '){
			n--;
		}
		while(n>=0&&s.charAt(n)!=' '){
			n--;
			len++;
		}
		return len;

		// return len;
	}