蓝桥账户中心
依次遍历 不符合条件就反转
题目要干嘛 你就干嘛
#include <bits/stdc++.h>#define endl '\n' using namespace std;int main() {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s;string t; cin >> t;int ret = 0;for ( int i = 0; i < s.size(); ++i ){if ( s[i] != t[i]){ //不等 反转硬币 s[i] = s[i] == 'o' ? '*' : 'o';s[i + 1] = s[i + 1] == 'o' ? '*' : 'o';++ret;}}cout << ret << endl;return 0;
}