Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let message = gets();
- let regex = /\W|_/g;
- let count = 0;
- let temp = 0;
- for(let i = 0; i < message.length; i++){
- if(message[i].match(regex) && message[i] != ' ' && message[i] != '.'){ // if its the specific char
- temp++;
- } else {
- if(temp > count){
- count = temp;
- temp = 0;
- } else {
- temp = 0;
- }
- }
- }
- print(count);
Advertisement
Add Comment
Please, Sign In to add comment