Definition:Substring

Definition
Let $$\mathcal L$$ be a formal language with alphabet $$\mathcal A$$.

Let $$\mathbf S$$ be a string in $$\mathcal A$$.

Let $$\mathbf T$$ be a string in $$\mathcal A$$ such that:
 * $$\mathbf S = S_1 \mathbf T S_2$$

where:
 * $$S_1$$ and $$S_2$$ are strings in $$\mathcal A$$ (possibly null);
 * $$S_1 \mathbf T S_2$$ is the concatenation of $$S_1$$, $$\mathbf T$$ and $$S_2$$.

Then $$\mathbf T$$ is called a substring of $$\mathbf S$$.

It follows from this definition that $$\mathbf S$$ is a substring of itself (by considering $$S_1$$ and $$S_2$$ as both null).