1347.cpp (366B)
1 class Solution { 2 public: 3 int minSteps(const string &s, const string &t) { 4 int res = 0, count[27] = {0}; 5 for (int i = 0; i < s.size(); i++) { 6 count[s[i] & 0x1F]++; 7 count[t[i] & 0x1F]--; 8 } 9 for (int i = 1; i < 27; i++) { 10 if (count[i] > 0) res += count[i]; 11 } 12 return res; 13 } 14 };