Given two binary strings, A and B, output 1 if B is a substring of A and 0 otherwise.

#codeifyoucansolve
Given two binary strings, A (of length 10) and B (of length 5), output 1 if B is a substring of A and 0 otherwise.

Please note, that the solution may only be submitted in the following languages: Brainf**k, Whitespace and Intercal.
Input

24 lines consisting of pairs of binary strings A and B separated by a single space.
Output

The logical value of: ‘B is a substring of A’.
Example

First two lines of input:

1010110010 10110
1110111011 10011

First two lines of output:
1
0

//sollution
#include <stdio.h>

int main()
{
 int T = 24,SI,MSI,two,flag,i,j;
 char str[25],sub[6];
 while(T--)
 {
 two = 1;
 SI = 0;
 MSI = 0;
 flag = 0;
 scanf("%s ",str);
 scanf("%s ",sub);
 for(i=4;i>=0;i--)
 {
 if(sub[i]=='0')
   two*=2;
  else
    {
       SI+=two;
       two*=2;
    }
 }
 for(i=23;i>=4;i--)
 {
 for(j=i;j>=(i-4);j--)
 {
 if(str[j]=='0')
    two*=2;
   else
     {
       MSI+=two;
       two*=2;
 } 
 }
 if(MSI%SI==0)
 {
   flag = 1;
   break;
 }
 
 }
 if(flag)
 printf("1\n");
 else
   printf("0\n");
 
 }
}

http://ideone.com/tSR5ET