whitespace-language

How to check whether a string is substring of another in WhiteSpace?

此生再无相见时 提交于 2019-12-07 21:38:34
问题 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 ? 回答1: 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 ==

How to check whether a string is substring of another in WhiteSpace?

倾然丶 夕夏残阳落幕 提交于 2019-12-06 10:45:59
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