Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Collections;
  3. import java.util.List;
  4. import java.util.Scanner;
  5.  
  6. public class OArticle2 {
  7. public static void main(String[] args) {
  8. Scanner scanner = new Scanner(System.in);
  9.  
  10. int n = Integer.parseInt(scanner.nextLine());
  11.  
  12. List<String> articles = new ArrayList<>();
  13.  
  14. for (int i = 0; i <= n ; i++) {
  15. String line = scanner.nextLine();
  16. articles.add(line);
  17.  
  18. Collections.sort(articles);
  19.  
  20. }
  21.  
  22. System.out.print(articles);
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement