-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy patheditDistance.cpp
More file actions
45 lines (41 loc) · 840 Bytes
/
editDistance.cpp
File metadata and controls
45 lines (41 loc) · 840 Bytes
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
43
44
45
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string editdistance(string s,string t) {
int n1=s.length();
int n2=t.length();
int a[26]={0};
int b[26]={0};
for(int i=0;i<n1;i++){
int temp = s[i];
a[97-temp]++;
}
for(int i=0;i<n2;i++){
int temp = t[i];
a[97-temp]++;
}
int ans=0;
for(int i=0;i<26;i++){
if(a[i]!=b[i]){ans++;}
}
return s;
}
};
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while(t--)
{
string s,t;
cin >> s;
cin >> t;
Solution ob;
cout<<ob.editdistance(s,t);
}
return 0;
}