Advertisement
Guest User

bla

a guest
Dec 7th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. const { getInput } = require('./utils')
  2.  
  3. async function main() {
  4. const data = await getInput('https://pastebin.com/raw/PkDeVV6L')
  5. let input = data.split(/\r?\n/)
  6.  
  7. const steps = 'qwertyuiopasdfghjklzxcvbnm'.split('')
  8. .reduce((acc, item) => {
  9. acc[item.toUpperCase()] = []
  10. return acc
  11. }, {})
  12.  
  13. input.forEach(line => {
  14. const data = line.split(' ')
  15. steps[data[1]].push(data[7])
  16. })
  17.  
  18. let start = null
  19. Object.keys(steps).forEach(key => {
  20. if (!steps[key].length) {
  21. start = key
  22. }
  23. })
  24.  
  25. console.log(steps)
  26. }
  27.  
  28. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement