Great, thanks man it works like a charm

Which approach is better if we take performance and speed into consideration?

Also how can I use concatenated strings in the most inner loop (i.e 3rd loop) so that I can directly compare the generated string with a certain string without implementing another loop that iterates over newStrings collection

Regards