Testcase 1,2,3 showing run-error :

code:

Hello @myself.yash.srivastav,

How are you so sure that there would not be more than 100 permutations?
Solution:
string out[100000];

Hope, this would help.
Give a like if you are satisfied.