Skip to main content
2 of 9
saved 10 and 14 bytes respectively
Arnauld
  • 197.7k
  • 20
  • 179
  • 650

JavaScript (Node.js),  112  102 bytes

With error checking.

s=>Buffer(s).some(c=>n?n-=c:c-111&&c-126?c-95?c-80|p++:0:!++a[n=c^17,p^c&1],a=[n=0,p=0])|p-1?'error':a

Try it online!


JavaScript (Node.js),  80  66 bytes

Without error checking.

s=>Buffer(s).map(c=>+s?s=0:c<96?p|=c<95:s=++a[p^c&1],a=[0,p=0])&&a

Try it online!

Arnauld
  • 197.7k
  • 20
  • 179
  • 650