POJ_3356_AGTC

#include <iostream> #include <string> using namespace std; string s1, s2; int l1, l2; int LCS(int x, int y) { if (x >= l1 || y >= l2) return 0; if (s1[x] == s2[y]) return 1+LCS(x+1, y+1); return max(LCS(x, y+1), LCS(x+1, y)); } int main() { while (cin>>l1) { cin>>s1>>l2>>s2; cout<<max(l1,l2)-LCS(0, 0)<<endl; } return 0; }

你可能感兴趣的:(include,stdstring)