#include #include #include using namespace std; #define DOWN 1 #define LEFT 2 #define DIAG 4 int pole[2010][2010]; char first[2010][12]; char second[2010][12]; int kudy[2010][2010]; int znac[2010][2010]; inline int MIN(int a, int b) { if (a>b) return b; else return a; } int main() { char buf[100]; int fcnt; int scnt; while (scanf("%s",first[1]),*first[1]!='.') { first[0][0]=0; second[0][0]=0; int fcnt=2; int scnt=1; do { scanf("%s",first[fcnt++]); } while (*first[fcnt-1]!='.'); --fcnt; while (scanf("%s",second[scnt]),*second[scnt]!='.') ++scnt; for (int i=0;i=pole[i][j-1]+((strcmp(first[i],second[j]))?1:0)) { pole[i][j]=pole[i][j-1]+((strcmp(first[i],second[j]))?1:0); kudy[i][j]|=LEFT; } if (pole[i-1][j]+((strcmp(first[i],second[j]))?1:0)<=pole[i][j-1]+((strcmp(first[i],second[j]))?1:0)) { pole[i][j]=pole[i-1][j]+((strcmp(first[i],second[j]))?1:0); kudy[i][j]|=DOWN; }*/ } } /* for (int i=fcnt-1;i>=0;i--) { for (int j=0;j=0;i--) { for (int j=scnt-1;j>=0;j--) { znac[i][j]=0; } } znac[fcnt-1][scnt-1]=1; for (int i=fcnt-1;i>=0;i--) { for (int j=scnt-1;j>=0;j--) { if (i+1=0;i--) { for (int j=0;j