2186.cpp (343B)
1 class Solution { 2 public: 3 int minSteps(const string &s, const string &t) { 4 int count[27] = {0}, res = 0; 5 for (const char c : s) 6 count[c & 0x1F]++; 7 for (const char c : t) 8 count[c & 0x1F]--; 9 for (int i = 1; i <= 26; i++) 10 res += abs(count[i]); 11 return res; 12 } 13 };