I want to generate all variations with repetitions of a string in C++ and I\'d highly prefer a non-recursive algorithm. I\'ve come up with a recursive algorithm in the past
here is general recipe, not C++ specific to implement product:
Take product input string "abc.." to generate matrix "abc.."x"abc..". N^2 complexity.
represent matrix as vector and repeat multiplication by "abc", complexity (N^2)*N, repeat.