Smart charger - how to detect current and voltage of different battery packs and then charge them accordingly
If you have a limited number of voltage variations you COULD use auto-detect of the voltage. eg if you had say 36V and 72V packs (10S and 20S) then the legal voltage ranges are at most 25 - 42 V and 50 - 84V. 42V is far enough below 50V IF NOTHING GOES WRONG to allow you to dostinguish between packs by voltage. But if you ever get an anomalous situtaion - unlikely but possible, where the 20 cell pack was down by another 8V (eg 3 fully dead cells) then your charger may rapidly render ALL the cells dead if it attempted discharging the pack for any reason. 

The only truly safe method is what is done in typical commercial applications - the batteries are "smart" and convey their identity to the charger in some manner. The "smartness" could be as simple as a resistor to uniquely identify the pack - but inclusion of a microcontroller is trivially easy and it can be used for other features such as usage tracking. 

I have seen laptops which accept 3S or 5S battery packs equally happily. This is easily accomplished once battery identification is independent of the actual battery.