https://ideone.com/vymv2v
I have used 1 for ‘(’ and -2 for ‘)’ and done arithematic calculations accordingly