Created
November 16, 2020 19:57
-
-
Save deepak2431/debc049e05017fa7e7d15dbc20bdde46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<vector> | |
#include<string> | |
#include<algorithm> | |
using namespace std; | |
int main() { | |
string s1, s2; | |
cin >> s1 >> s2; | |
transform(s1.begin(), s1.end(), s1.begin(), ::tolower); | |
transform(s2.begin(), s2.end(), s2.begin(), ::tolower); | |
int similarchCount = 0; | |
vector<int>s1Count(26, 0); | |
vector<int>s2Count(26, 0); | |
for(int i = 0; i < s1.size(); i++) { | |
s1Count[s1[i] - 'a']++; | |
} | |
for(int i = 0; i < s2.size(); i++) { | |
s2Count[s2[i] - 'a']++; | |
} | |
for(int i = 0; i < 26; i++) { | |
similarchCount += min(s1Count[i], s2Count[i]); | |
} | |
int ans = s2.size() - similarchCount; | |
cout << ans << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment