Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = ['5',
- 'telerik',
- 'alpha',
- 'java',
- 'Spring',
- 'nodeJS'];
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let alphabet = "0abcdefghijklmnopqrstuvwxyz".split('');
- let wordsCount = +gets();
- let sum = 0;
- let wordWeight = 0;
- for(let i = 0; i < wordsCount; i++){
- let word = gets().toLowerCase();
- let wordArr = word.split('');
- // console.log(wordArr);
- let weight = alphabet.indexOf(wordArr[i] + '');
- sum += weight;
- console.log(sum + word)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement