#include <iostream>
#include <string.h>

using namespace std;

int main()
{
   char *input = "141592653589793238462643383279502884197";
   char *test  = "33384";
   double pc   = .8;
   
   int len  = strlen(test);
   int good = len * pc;

   for(int pos = 0; pos < strlen(input)-len; ++pos)
   {
       int matches = 0;
       for(int pos1 = 0; pos1 < len; ++pos1)
       {
           if(test[pos1] == input[pos + pos1]) matches++;
           
           // below is a small optimisation attempt. It should significantly improve the performance
           if(len - pos1 < good - matches)
                break; // exiting earler. no reason to stay in the loop
       }
       
       if(matches >= good)
       {
            cout << pos << " " << input + pos << endl;
       }
   }
   return 0;
}
