#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
int brute(char word[25]);
void main(void)
{
  time_t now;
  int totalTime,stTime,c;
  char find[25];
  printf("\nFind>>");
  scanf("%s",find);
  stTime=time(&now);
  c=brute(find);
  totalTime=time(&now)-stTime;
  if(totalTime==0){
    printf("The computer found it in less then a second and ran through %d combinations\n\a",c);
  } else {
    printf("The computer found it in %d seconds and ran through %d combinations\n\a",totalTime,c);
  }
  exit(0);
}
int brute(char word[25]){
  int i,bit=0,counter=0;
  char comp[25];
  for(i=0;i!=25;i++){
    comp[i]='\0';
  }
  while(strcmp(comp,word)!=0){
    switch(comp[bit]){
       case '\0':comp[bit]='0';break;
       case '9':comp[bit]='A';break;
       case 'Z':comp[bit]='a';break;
       default:comp[bit]++;
    }
    if(comp[bit]=='{'){
       comp[bit]='0';
       bit++;
    } else {
       bit=0;
    }
    counter++;
  }
  return(counter);
}