Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- '3,-12,0,0,13,5,1,0,-2',
- ];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let list = gets().split(',').map(Number);
- let all = [];
- // all = [list.length];
- let bellow = [];
- let above = [];
- let zero = [];
- if (list.length >= 1 && list.length <= 20) {
- for (i = 0; i < list.length; i++) {
- all[i] = (list[i]);
- }
- for (i = 0; i < all.length; i++) {
- if (all[i] < 0) {
- bellow.push(all[i]);
- } else if (all[i] > 0) {
- above.push(all[i]);
- } else if (all[i] == 0) {
- zero.push(all[i]);
- }
- }
- }
- let output = [];
- output.push(bellow);
- output.push(zero);
- output.push(above);
- console.log(output.join(','));
Advertisement
Add Comment
Please, Sign In to add comment