Medium
One Department, One Spelling
The
dept column was typed by hand, so the same department appears as CSE, cse or Cse . Clean it (remove spaces at the ends, make it upper case), then print each department and its count, most common first; break ties alphabetically.Input
A CSV table: a header line, then one line per row (an empty field means a missing value), then a line END.
Output
One line per department: NAME count.
Sample 1
Input
dept,score CSE,80 cse,70 Cse ,90 EEE,60 eee ,55 BBA,40 END
Output
CSE 3 EEE 2 BBA 1
Sample 2
Input
dept bba BBA Bba cse CSE END
Output
BBA 3 CSE 2
Output appears hereHints