I tried to implement this using string

i tried the approach using string data structure but there is no output

link : https://pastebin.com/eaQNKnBi

please help , i am very curious.

the size of string does not increase by doing s[i] if i does not exist.
Append by doing s += ‘(’


you can see i tried implementing it. but it is not working.
can you provide me a working solution

@pewpiyu this method is valid for character arrays but since you are using the string datatype you have to change the way you append to the string, like s += “(” instead of s[i] = “(”

i am doing that only . see the image.

@pewpiyu https://ideone.com/jvrSwX