I have a string like this:
(A,X(B,C,D),X(E,F),G,H)
and i want to transform it to to an array like this :
[{A}, {X(B,C,D)}, {X(E,F)}, {G}, {H}]
The input String can have nested elements like this
(A,X(B,X(A,B),D))
I thought to do it with tree structure. What is the best way to do it in java ?