#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void boyer_moore(char *pat,char *text)
{
    int i,table[256];
    int len=strlen(pat);
    int len_text = strlen(text);
    int ptct,count;

    for(i=0;i<256;i++)table[i]=len;
    for(i=0;i<len;i++)table[pat[i]]=len-(i+1);
    ptct=len-1;
    while(ptct<len_text)
     {
       count=0;
       while(count<len)
         {
           if(text[ptct-count]!=pat[len-1-count])break;
           else count++;
         }
       if(count==len)
         {
           printf("Gefunden an Pos. %d\n",ptct);
           ptct+=len;
         }
       else ptct+=table[text[ptct-count]];
     }
}


int main()
{
 boyer_moore("ex", "a example extra text");

 return 0;
}