#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
int solution(const string& s) {
// PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
// write code here
std::map<char, int> map;
for(auto c: s){
if(c == 'K' || c == 'k'){
map['k']++;
}else if(c == 'u' || c == 'U'){
map['u']++;
}
}
return std::min(map['k'], map['u']);
}
int main() {
cout << (solution("AUBTMKAxfuu") == 1) << endl;
cout << (solution("KKuuUuUuKKKKkkkkKK") == 6) << endl;
cout << (solution("abcdefgh") == 0) << endl;
}
简单题