• + 0 comments

    My JavaScript solution;

    function processData(input) {
        //Enter your code here
        const [returnDate, dueDate] = input.split("\n").map(d => d.split(" ").map(s => parseInt(s)))
        if((returnDate[0] <= dueDate[0] && returnDate[1] <= dueDate[1] && returnDate[2] <= dueDate[2]) || returnDate[2] < dueDate[2]) {
            return console.log(0)
        }
        if(returnDate[0] > dueDate[0] && returnDate[1] === dueDate[1] && returnDate[2] <= dueDate[2]) {
            return console.log(15 * (returnDate[0] - dueDate[0]))
        }
        if(returnDate[1] > dueDate[1] && returnDate[2] === dueDate[2]) {
            return console.log(500 * (returnDate[1] - dueDate[1]))
        }
        if(returnDate[2] > dueDate[2]) {
            return console.log(10000)
        }
    }