I have the following chars to whom I want to assign numbers consecutively if they are in the same bracket. E.g.

```
   [a,b],[c],[d,e],[f,g],[h]
   a=0, b=1,c=2,d=3,e=4,f=5,g=6,h=7

```

From the given char I want to retrieve the number which I can do with std::map in c++. However, once i assign these numbers with map. I loose the information that [a,b] are in one bracket and [c] is separate. This information I want to retain.

Is there some data structure which I can use such that: [a,b] can be assigned consecutive numbers and also I can get the information that [a,b] are in one bracket and [c] is the only ones in its bracket.

My approach was to use map...but it does not fit my need of later finding out whether [a,b] are in the same bracket. Can someone please suggest a data structure such that it satisfies my need of assigning numbers consecutively as well as retaining the information that they belong to the same bracket.