Advertisement
Guest User

Untitled

a guest
May 22nd, 2016
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.LinkedHashMap;
  4. import java.util.Scanner;
  5.  
  6. /**
  7. * Created by pesho on 20.5.2016 г..
  8. */
  9. public class FixEmails {
  10. public static void main(String[] args) {
  11. Scanner scan = new Scanner(System.in);
  12. LinkedHashMap<String, String> listEmails = new LinkedHashMap<>();
  13.  
  14. for (int i = 1; i <= 10; i++) {
  15. String person = scan.nextLine();
  16. if (person.equals("stop")) {
  17. break;
  18. }
  19.  
  20. String email = scan.nextLine().toLowerCase();
  21. if (!email.endsWith(".us") && !email.endsWith(".uk")) {
  22. listEmails.put(person, email);
  23. }
  24. }
  25.  
  26. for (String person : listEmails.keySet()) {
  27. System.out.printf("%s -> %s%n", person, listEmails.get(person));
  28. }
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement