💡Understanding Prefix and Suffix:

Example - 1:

Pattern = ABC

Prefix: Suffix:
A C
AB BC
ABC ABC

Note: Here we will consider only Which are Proper Prefix or Proper suffix


🤷🏻 What is Proper Prefix or Proper Suffix?

In formal language theory, a proper prefix and proper suffix of a string are defined as follows:


Example - 2:

Pattern = ABAB