# ngn/k, 22 bytes: 

```
{x(+j)@&~|/=':j:!y##x}
```

[Try it online](https://ngn.codeberg.page/k#eJyrrtDQztJ0UKur0bdVt8qyUqxUVq6ojVby8vfwU7I2jQUAmqUJGw==)