I have some problems with recursion and to understand it I'm trying to make up questions for myself and solve them. This particular question has gotten me confused:
consider this as an input in the form of a string:

```
[[a,b,c],[[d]],[[e,f]],[g],h,i,[[j,[k,l]]]]

```

the goal is to find the total number of things in the lists and the lists them self.for this example the result would be:`12`+`10` = `22`
note that the input is not an array,it is a string.Also instead of `a`,`b`,...
anything can be used,like numbers,strings etc.  

```
[12345,0.34,["afv",24]]

```

This is my idea but I will mention why I cant implement it:  

We write a function that starts iterating the string.It should count the total thing between `[` and `]`.whenever the function reaches a `[` it will recall itself to iterate through the remaining string.This way it can go deeper into the arrays.  

These are my problems:  

1. I don't know whether my idea is correct or not.
2. If my idea is correct,what is the base case.
3. How can I make sure that it counts all the things inside regardless of in what are they?(I mean how can I make sure it treats numbers,strings etc the same)
4. I think the body of the function should look like this(I'm using java here but I don't think the language is very important here):  

`public static int counter(String a){
 int sum = 0;
 //some code to iterate the string
 //some code to check the conditions and if needed call the method 
 //some code to add the number of objects and arrays to sum
 return sum;
 }`

If the code should like what I said then how can I fill the body?
Thank you for your time.