Revision 77b185e5-295e-4b13-909c-58fd6da405ad - Code Golf Stack Exchange
# [Röda], 45 bytes
f s{s~=`(\S)\S* (?=\S*1円)`,"";[not(" "in s)]}
[Try it online!]
This is a port of the Perl 5 solution, which is a port of the Retina solution by Martin Ender.
Here's a different solution (<s>73</s> 72 bytes):
{[_/""]|{|x|{x|[0]()unless[not(_ in y)]else[1]}if tryPeek y}_|sum|[_=0]}
It's an anonymous function that pulls strings from the stream and checks that the consecutive strings contain same characters. Explanation:
{
[_/""]| /* split strings -> creates arrays of characters */
{|x| /* begin for loop over character arrays */
{ /* begin if tryPeek(y) -> peeks the second item from the stream */
/* x and y are now two consecutive character arrays */
x| /* push characters in x to the stream */
[0]()unless[not(_ in y)]else[1] /* pushes 0 to the stream */
/* if y contains the character */
/* in the stream, otherwise 1 */
}if tryPeek y
}_| /* end for loop */
sum| /* sum all numbers in the stream */
[_=0] /* return true if the sum is zero */
}
It could possibly be golfed more...
[Röda]: https://github.com/fergusq/roda
[Try it online!]: https://tio.run/nexus/roda#VY3BCoJAEIbP7lP87EnDwF3dVQvpITyqZKSChzTcvYm9uo1GQcww//B9MLN2MLN5ZbVb5l6ZH@BeMopSeLXP@bkYRuty8H6A8aplfdxom5nTjRNsa@z1fjMtmpE5znPqB4vO/eHidBSV54OXlvv4x8xpxqFlyyqw19afYEJChggjRApKM02TdiLENxtCpkihqEkRDEQMuYlI6ThJAwjypIL9EhOQCBFB7X@@54kolqRIYsR6f7zxNw "Röda – TIO Nexus"