Skip to content

Instantly share code, notes, and snippets.

@walkingmask
Created October 25, 2016 04:10
Show Gist options
  • Select an option

  • Save walkingmask/a2ed5d847ab8da20313b92d288cc4f38 to your computer and use it in GitHub Desktop.

Select an option

Save walkingmask/a2ed5d847ab8da20313b92d288cc4f38 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int len1, len2, i, counts[32], result;
char s[131072], t[131072];
int main(void){
// input
scanf("%d %d", &len1, &len2);
scanf("%s", s);
scanf("%s", t);
// init
for (i=0; i<26; i++) {
counts[i] = 0;
}
// count
for (i=0; i<len1; i++) {
counts[s[i]-97]++;
}
for (i=0; i<len2; i++) {
counts[t[i]-97]--;
}
// result
for (i=0, result=0; i<26; i++) {
if (counts[i] < 0) result += -1*counts[i];
}
printf("%d\n", result);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment