In XYZ country there is rule that car’s
engine no. depends upon car’ number plate. Engine no is sum of all the
integers present on car’s Number plate.The issuing authority has hired
you in order to provide engine no. to the cars.Your task is to develop
an algorithm which takes input as in form of string(Number plate) and
gives back
Engine number.
Engine number.
Input Description:
You are given a string ’s’
You are given a string ’s’
Output Description:
Print the engine number
Print the engine number
Sample Input : HR05-AA-2669
Sample Output : 28
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = (data);
var b=data.join('');
var c=b.split("")
var sum= +c[2]+ +c[3]+ +c[8]+ +c[9]+ +c[10]+ +c[11]
console.log(sum)
});
2 PRIVATE TEST CASE ERROR
Comments
Post a Comment