I was going through problems on SPOJ, when I saw this SBStr1. I learnt a little bit of WhiteSpace language, but I could reach only up to loops.
Can anyone please help me on how to check if a string has another string as a substring in WhiteSpace ?
I'm not going to write the Whitespace code for you but here is an approach you can take that easily translates to Whitespace:
24 times:
read 10 bit number into A
skip space
read 5 bit number into B
skip newline
if (A>>0)%32 == B or (A>>1)%32 == B or ... or (A>>5)%32:
print 1
else:
print 0
print newline
You can implement the bitshifts through repeated division by 2.