-
Notifications
You must be signed in to change notification settings - Fork 49
/
strdiff.cpp
42 lines (30 loc) · 834 Bytes
/
strdiff.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <dtl/dtl.hpp>
#include "common.hpp"
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using dtl::Diff;
int main(int argc, char *argv[]){
if (isFewArgs(argc)) {
cerr << "Too few arguments." << endl;
return -1;
}
typedef char elem;
typedef string sequence;
sequence A(argv[1]);
sequence B(argv[2]);
Diff< elem, sequence > d(A, B);
//d.onOnlyEditDistance();
d.compose();
// editDistance
cout << "editDistance:" << d.getEditDistance() << endl;
// Longest Common Subsequence
vector< elem > lcs_v = d.getLcsVec();
sequence lcs_s(lcs_v.begin(), lcs_v.end());
cout << "LCS:" << lcs_s << endl;
// Shortest Edit Script
cout << "SES" << endl;
d.printSES();
return 0;
}