Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const readline = require('readline');
  2.  
  3. const rl = readline.createInterface({
  4.     input: process.stdin
  5. });
  6.  
  7. let length;
  8. let arr = [];
  9. rl.on('line', (line) => {
  10.     if (length === undefined) {
  11.         length = Number(line);
  12.     } else {
  13.         if (arr.length < length) {
  14.             arr.push(line);
  15.         }
  16.        
  17.         if (arr.length === length) {
  18.         }
  19.     }
  20. })
  21. .on('close', () => {
  22.     let result = 0;
  23.     let comb = 0;
  24.    
  25.     for (let i = 0; i < arr.length; i++) {
  26.         if (!!arr[i]) {
  27.             comb++;
  28.         } else {
  29.             result = comb > result ? comb : result;
  30.             comb = 0;
  31.         }
  32.     }
  33.    
  34.     process.stdout.write(result.toString());
  35. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement