Skip to content

Practice Find Maximum Number of Non Intersecting Substrings

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3557
LeetCode Problem

Find Maximum Number of Non Intersecting Substrings

Problem Statement

You are given a string word. Return the maximum number of non-intersecting substrings of word that are at least four characters long and start and end with the same letter.

Source: Find Maximum Number of Non Intersecting Substrings on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
word = "abcdeafdef"
Output
2

# Example 2

Input
word = "bcdaaaab"
Output
1

Constraints

1 <= word.length <= 2 * 10^5
word consists only of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Find Maximum Number of Non Intersecting Substrings.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.