@@ -9,14 +9,14 @@ public static void main(String[] args) {
99 Map <String , Map <String , List <Integer >>> submissionInfoMap = new LinkedHashMap <>();
1010 Map <String , List <Integer >> countSubmissionsMap = new LinkedHashMap <>();
1111
12- String line ;
12+ String input = scanner . nextLine () ;
1313
14- while (!( line = scanner . nextLine ()) .equals ("exam finished" )) {
14+ while (!input .equals ("exam finished" )) {
1515
1616 String [] command ;
17- if (!line .contains ("banned" )) {
17+ if (!input .contains ("banned" )) {
1818
19- command = line .split ("-" );
19+ command = input .split ("-" );
2020 String username = command [0 ];
2121 String language = command [1 ];
2222 int points = Integer .parseInt (command [2 ]);
@@ -28,12 +28,14 @@ public static void main(String[] args) {
2828 countSubmissionsMap .get (language ).add (points );
2929 } else {
3030
31- command = line .split ("-" );
31+ command = input .split ("-" );
3232 String oldUsername = command [0 ];
3333 String newUsername = command [1 ];
3434 submissionInfoMap .put (oldUsername , submissionInfoMap .put (newUsername , submissionInfoMap .get (oldUsername )));
3535 submissionInfoMap .remove (oldUsername );
3636 }
37+
38+ input = scanner .nextLine ();
3739 }
3840
3941 printResults (submissionInfoMap );
0 commit comments