  text = text.slice(0, -subText.length);
                            break;
                        } else {
                            // If the subText is not in the dictionary, then remove the first character of the subText
                            subText = subText.slice(1);
                        }
                    }
                }
                // Reverse the result to get the correct order
                result = result.reverse();
                return result;
            }

          