**INITIALLY YOU ARE GIVEN TWO STRINGS S AND T OF LOWER CASE LATIN WORDS. YOU CAN REPLACE ANY CHARACTER OF S WITH STRING T,ANY NUMBER OF TIMES . YOU APPLY THE SAME PROCEDURE ON THE NEW STRING FORMED BY REPLACING A CHARACTER . LET S=s1,s2,s3,s4...sn (si is the ith character) and T = "ab". THEN YOU CHANGE s1-->T . HENCE new string becomes ab,s2,s3,s4...sn. Now you can further change any character of this new string with T . NOW YOU HAVE TO FIND THE TOTAL NUMBER OF UNIQUE STRINGS YOU CAN CREATE BY DOING THE ABOVE PROCESS ANY NUMBER OF TIMES(POSSIBLY ZERO).
SOME EXAMPLES :
S="abc" T ="dk" output =-1 since [dkbc,ddkbc,ddkbdc,.....infinte newstrings can be created] s="abc" T="x" output =8 since[abc,abx,axb,xbc,axx,xxc,xbx,xxx] s="aab" T="ab" output=-1 since[aaab,aaaab,.....infinite new strings can be created] s="ab" T="d" output=4 since[ab,ad,bd,dd]
######
**