If I'm getting this correctly, given a set of arguments, you put | after each param.
After this you remove one or more original params from the string in order to get the keys.
The keys then have to be returned in an array/vector.
Firstly, do you need to have two separate params (a&b) in the first example? If you have an array, will that suffice?
Once you have an input array, the steps may become a lot clearer.