string mp - changed algorithm for generating strings of given length