public int nesting ( String S ) {
		int nested = 0;
		S = S.trim();
		//account for the empty string
		if (S.length() == 0){
			nested = 1;
		} else {
			Stack<Character> stack = new Stack<Character>();
			int strLen = S.length();
			for (int i = 0; i < strLen; i++){
				if (S.charAt(i)==('(')){
					//push onto the stack
					stack.push('(');
				} else if (S.charAt(i)==(')')){
					//peek to see if there's a ( , if so we pop it
					if (!stack.empty() && stack.peek()=='('){
						stack.pop();
					} else if (stack.empty()){
						return 0;
					}
				}
			}//end for
			//now check if our stack is empty, should be if we have a properly nested string
			if (stack.empty()){
				return 1;
			}
		}//end else
		return nested;
	}