Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.task.task08.task0829;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.*;
- /*
- Модернизация ПО
- */
- public class Solution {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- Map<String, String> map = new HashMap<>();
- while (true) {
- String lastName = reader.readLine();
- String city = reader.readLine();
- if (lastName.isEmpty() || city.isEmpty()){
- break;
- }
- map.put(lastName, city);
- }
- String nowCity = reader.readLine();
- Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
- while (iterator.hasNext()){
- Map.Entry<String, String> pair = iterator.next();
- if (pair.getValue().equals(nowCity)){
- System.out.println(pair.getKey());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement