Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function partyTime(input) {
- let invitedList = input.splice(0, input.indexOf("PARTY"));
- input.splice(0, 1);
- let VIP = [];
- let regular = [];
- for (let guest of invitedList) {
- if (guest[0] >= '0' && guest[0] <= '9') {
- VIP.push(guest);
- } else {
- regular.push(guest);
- }
- }
- for (let guest of input) {
- if (VIP.includes(guest)) {
- VIP = VIP.filter(x => x !== guest);
- }
- if (regular.includes(guest)) {
- regular = regular.filter(x => x !== guest);
- }
- }
- console.log(VIP.length + regular.length);
- VIP.forEach(x => {
- console.log(x);
- });
- regular.forEach(x => {
- console.log(x);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement