Question link : https://www.codechef.com/problems/STR
question is :
Little John just had his first class in school. He was taught first 20
letters of English alphabet and was asked to make words from these
alphabets.
Since he doesn't know many dictionary words, he quickly finished this work
by making random strings from these alphabets.
Now while other kids are busy creating their words, John gets curious and
puts all the strings he created in a list and named it X.
He picks two indices 'i' and 'j' ( not necessarily distinct). He assigns A
as X[i] and B as X[j]. He then concatenates both the strings to create a new
string C ( = A + B ). He calls a string "super string" if that string
contains all the 20 letters of English alphabet he has just learnt,atleast
once.
Given the strings of the list, can you tell him how many such unordered
pairs (i,j) he can choose such that string C is a super string.
Editorial : https://discuss.codechef.com/questions/79843/str-editorial
I cannot understand logic of dp here.Can someone help me ?