#include <iostream>
#include <vector>
#include <string>
//首先贪心算法,明确插入是最好策略
//将问题转化为寻找字串ucc uc cu cc uu 这些的花费
int solution(int m, std::string s) {
// PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
// write code here
//寻找UCC 无代价 UC CC 一代价 子串
std::vector<int> consume = {0,0,0}; //记录代价的数量。 eg:consume[0]的值表示UUC子串数量
std::string temp_string = "";
for(int i = 0; i < s.size(); i++){
if(temp_string == "UC"){
if(s[i] == 'C'){
consume[0]++;
temp_string = ""; //记录清零
}else if(s[i] == 'U'){
consume[1]++;
temp_string = "U";
}
}else if(temp_string == "C"){
if(s[i] == 'C'){
consume[1]++;
temp_string = ""; //记录清零
}else if(s[i] == 'U'){
consume[2]++;
temp_string = "U"; //重新记录
}
}else if(temp_string == "U"){