I don't understand why example 2 returns false

Why is this false:

Input: String="odicf"
Output: false
Explanation: No permutation of the pattern is present in the given string as a substring.

“dc” is in the string, I don’t understand why it’s false.

Type your question above this line.


Hi @john2 ,
Yes d and c are in the string but not as a consecutive sequence. By definition, a substring is a contiguous sequence of characters. d and c are separated by an i between them hence the output false.