PROBLEM 72
Medium

Login and Password

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#72

Login and password are entered on separate lines. The correct credentials are login `admin` and password `code123`. Print `ACCESS GRANTED` for that exact pair; otherwise print `ACCESS DENIED`.

EXAMPLE

Example

Input
admin
code123
Output
ACCESS GRANTED

LIMITS

Constraints

both strings are not empty
📖
LEARN Theory for this problem
+

### Login and Password

JavaScript arithmetic works with numeric values stored in variables. A clear solution reads the needed values, computes the formula with `+`, `-`, `*`, `/` or `**`, and prints only the final result.

💡
NEED HELP? Hints
+

['Write the formula using named intermediate values if it contains more than one operation.', 'Check the first and last characters separately, and preserve meaningful spaces or letter case when the statement requires it.']

ANSWER Solution
+
const fs = require('fs');

const lines = fs.readFileSync(0, 'utf8').split(/\r?\n/);
const login = lines[0] ?? '';
const password = lines[1] ?? '';

const correct = login === 'admin' && password === 'code123';

console.log(correct ? 'ACCESS GRANTED' : 'ACCESS DENIED');