Hi xpi0t0s,

Thanks a lot for your help,

this is the way i need my output array of strings to be like,

For example a( b( c( d ) ) ) my substring array would be

a( b( c( d ) ) )
b( c( d ) )
c( d )
d

However said that the strings may not be as simple in the sense that it may also be as

a( b( c( d ) ) ) ^ e(f(g)))

in which case my substring set would be:

a( b( c( d ) ) ) ^ e(f(g)))
a( b( c( d ) ) )
b( c( d ) )
c( d )
d
e(f(g)))
f(g)
g


Another constraint is that i can also have a(b(a(c)))
i.e 'a' repeting more than once ( it is for this i have tried to use recursion)

for the above case my substrings would be:
a(b(a(c)))
b(a(c))
a(c)
c


yes it was and operator, i ran the code after making those corrections however i still get the segmentation fault. please help