Advertisement
vov44k

Untitled

Apr 24th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Arrays;
  3.  
  4. public class t112409 {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner in = new Scanner(System.in);
  8.  
  9.         int n = in.nextInt();
  10.         String[] s = new String[n];
  11.  
  12.         for (int i = 0; i < n; ++i) {
  13.             in.next();
  14.             s[i] = in.next();
  15.         }
  16.  
  17.         Arrays.sort(s);
  18.  
  19.         for (int i = 0; i < n; ++i) {
  20.             System.out.print((i + 1) + ". ");
  21.             System.out.println(s[i]);
  22.         }
  23.  
  24.         in.close();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement