We have a two strings: A and B. We need to find miniumum number of times that we could concatenate B to get A. Also we can omit any number of letters from B in any of the concatenations if we want. Example:
A = "ZAZA" B = "BAZ"
A is obtained from 3 copies of B A= (--Z)(-AZ)(-A-)
Can you suggest any algorithmic approach which is better than O(nm) where n is length of A and m is length of B.