Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(inp) {
- let start = inp.shift().charCodeAt();
- let end = inp.shift().charCodeAt();
- let string = inp.shift();
- let i = start;
- let sum = 0;
- while (i <= end) {
- let curChar = String.fromCharCode(i);
- if (string.includes(curChar)) {
- sum += curChar.charCodeAt();
- }
- i++;
- }
- console.log(sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement