Problem Statement Implement SortingHat :A school hostel assignment Program
New students join a school and need to be assigned to one of 4 boarding houses. As students come in,they register their roll number, class & food preference. There are 2 classes - A and B, and two foodpreferences - V & NV. There are 4 boarding houses with equal but limited capacity. The hat follows afirst in first out policy with the following rules -
Queue will be processed based on the time a student registered, first in first out
●Boarding houses for students who prefer V cannot board NV students
●Boarding houses for class A would be separate from boarding houses for class B
●Once all boarding houses are filled up to capacity, no more students can be allocated.
●Other rules
○Roll number is a 4 digit integer unique to each student
○Student can only be registered once, duplicate commands for same student may be ignored
The following is an example of input -should produce the following output (in any order) -
init
12reg 1 B Vreg 2 A Vreg 3 A Vreg 4 B NVreg 5 B Vreg 6 A NVreg 7 A Vreg 8 A NVreg 9 B NVreg 10 B Vreg 11 A NVreg 12 B NVfin
```output
BV : [1,5,10]AV : [2,3,7]BNV : [4,9,12]ANV : [6,8,11]NA : []