Originally Posted by
itCbitC
Why is that any different than normal processing?
Just skip o'er the duplicates until a matching char is found?
Make sure to advance the pointer to the next char on the substring.
The problem is that anything i try simply does not give me any positive result.
Here is the code of what i have tried to do, based on the idea you gave.
Still no results.
Code:
#include <stdio.h>
#include <string.h>
int main()
{
int i, n, k, c, d[251], y, z , j = 0, u = 0, r = 0;
char a[251], b[251];
FILE *file;
file = fopen("text.txt", "r");
fscanf(file, "%d", &n);
for(i = 0;i < n;i++)
{
fscanf(file, "%s %s", a, b);
y = strlen(a);
z = strlen(b);
for(k = 0;k < y;k++)
{
for(j;j < z;j++)
{
if(a[k] == b[j]) {
if(j = d[k]) break;
d[k] = j;
j++;
}
}
printf("d[%d] = %i\n", k, d[k]);
}
}
fclose(file);
return 0;
}