AcWing 1208. 翻硬币
仅供自己课后学习
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
const int N = 100;
int n;
char start[N],aim[N];
void turn(int i)//实现换硬币正反的操作
{
if(start[i] =='*') start[i] ='o';
else start[i] = '*';
}
int main(){
cin>>start>>aim;//两条字符串
n = strlen(start);
int res = 0;
for(int i = 0;i<n-1;i++)
if(start[i]!=aim[i]){
turn(i),turn(i+1);
res++;
}
cout<<res<<endl;
return 0;
}