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”.
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.