Write algorithm for below program
# input data
Above contents are dynamic and based on that below collection object will get created.
# expected output
Any help would be appreciated.
Expected output should be in the form of collection object like Map<String, set<Map, Set<String>>>. This is my understanding if required please provide your thoughts.