Proper explanation needed

we have to consider characters of second string as many times they are present in second string or considering same character once only ?

You need to consider them only once.
string 2 : abc or abababac
Doesn’t matter, we will consider a,b,c only