Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input = gets().split(' ');
  2. let specialCharacters = [];
  3.  
  4. // Removing all letters, whitespaces and numbers from each word of the input
  5. input.forEach(element => {
  6.     let specialWord = element.replace(/[0-9a-zA-Z .]/g, "");
  7.     specialCharacters.push(specialWord);
  8. });
  9.  
  10. // Removing the empty strings (if any) from the specialCharacters array
  11. let filteredSpecialCharacters = specialCharacters.filter(function(e){return e});
  12.  
  13. // Finding the longest word from te specialCharacters array
  14. let longestSymbols = Math.max(...(specialCharacters.map(el => el.length)));
  15.  
  16. print(longestSymbols);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement