• + 0 comments
    function processData(input) {
    
        const inputLines = input.split('\n');
        
      
        const entryCount = parseInt(inputLines[0]);
        
        
        const phoneBook = {};
        
    
        for (let i = 1; i <= entryCount; i++) {
            const [name, phoneNumber] = inputLines[i].split(' ');
            phoneBook[name] = phoneNumber;
        }
        
        
        for (let i = entryCount + 1; i < inputLines.length; i++) {
            const queryName = inputLines[i];
            if (queryName) { // Check if there is a query
                if (phoneBook[queryName]) {
                    console.log(`${queryName}=${phoneBook[queryName]}`);
                } else {
                    console.log('Not found');
                }
            }
        }
    }