# Help me to understand how BT a substring of BAT?

https://www.educative.io/courses/grokking-the-coding-interview/NEOZDEg5PlN

Please help me to understand that how BT is a substring of BAT? Thus 1A1 as one of the required set in the answer? Though BT could be a set in powerset of BAT, but I am not sure how it is a substring? Am I missing something here?

βBTβ is not a substring of βBATβ.

We get β1A1β by replacing two different substrings in βBATβ, these substrings are βBβ and βTβ.

1 Like

with that logic, why canβt we replace 3 different substrings βBβ, βAβ, and βTβ and replace them in the original string to get β111β?

In that case, we should consider the whole string as the substring (and not the individual characters as different substring). This means we will be getting the abbreviation β3β and not β111β. Though this is not explicitly stated in the problem statement, but all contiguous characters should be considered as one substring.

Looks like the problem statement is not clear about this. We will be adding a statement to clear this confusion. Thanks for pointing this out.