We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
cout<<cnt;
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}
check out your code for test case:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
It is overwriting the value of array a 2 times
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
include
using namespace std;
int main() { string s2,s1; int a[123]={0},b[123]={0},cnt=0; cin>>s1>>s2; for(int j=0;j<(s1.size());j++) { a[s1[j]]++; } for(int i=0;i<(s2.size());i++) { b[s2[i]]++; } /for(int j=97;j<123;j++) {cout</ for(int j=97;j<123;j++) if(a[j]!=b[j]) { cnt+=abs(a[j]-b[j]); //cout<
}
check out your code for test case: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb It is overwriting the value of array a 2 times