text: module.exports = function check(str, bracketsConfig) {
    bracketsConfig = bracketsConfig.map(item => item.join(''));
    return result(str, bracketsConfig);
  }
  
  function checkIncludes(str, arr) {
    for (let i = 0; i < arr.length; i++) {
      if (str.includes(arr[i])) return true;
    }
    return false;
  }
  
  function cutBrackets(str, arr) {
    for (let i = 0; i < arr.length; i++) {
      str = str.replace(arr[i], '');
    }
    return str;
  }
  
  function result(str, arr) {
    if (str.length == 0) {
      return true; 
    } else if (checkIncludes(str, arr)) {
      str = cutBrackets(str, arr);
      return result(str, arr);
    } else return false;
  }