private String removeBracket(String str) throws Exception {
		if (!(str.startsWith("(") && str.endsWith(")")))//括弧で始まっていなければ、そのまま返す
			return str;
		
		int nest = 1;

		for (int i = 1; i < str.length() - 1; i++) {
			if (str.charAt(i) == '(')
				nest++;
		    else if (str.charAt(i) == ')')
		        nest--;
			if (nest == 0)
		        return str;
		}

		if (nest != 1)
			throw new Exception("unbalanced bracket: " + str);

		str = str.substring(1, str.length() - 1);

		if (str.startsWith("("))
			return removeBracket(str);
		else
			return str;
	}