/* Topcoder SRM */ /*****************************************************************************/ int GooseTattarrattatDiv2::getmin(string S) { int c[26]; int n=S.size(); memset(c, 0, sizeof(c)); for (int i=0; i<n; i++) { c[S[i]-'a']++; } int r=INT_MAX; for (int i=0; i<26; i++) { if (!c[i]) { continue; } r=min(r, n-c[i]); } return r; } /*****************************************************************************/
Topcoder SRM 589 DIV2 EASY
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment