int sizeOfNextSubPiece(String content) {
        if (content.charAt(0) != openingBracket)
            return -1;
        int openBrackets = 0;
        char c;
        char[] chars = content.toCharArray();
        for (int i = 1; i < chars.length; i++) {
            c = chars[i];
            if (c == openingBracket)
                openBrackets++;
            if (c == closingBracket) {
                openBrackets--;
                if (openBrackets == -1)
                    return i;
            }
        }
        return content.lastIndexOf(closingBracket);
    }