#include<iostream>#include<cstring>#include<algorithm>#include<unordered_set>usingnamespace std;intget(string a,int b){int res =0;for(int i =0; i < a.size(); i ++){
res = res * b + a[i]-'0';}return res;}intmain(){
string a, b;
cin >> a >> b;
unordered_set<int> S;for(auto& c : a){char t = c;for(int i =0; i <2; i ++){if(i +'0'!= c){
c = i +'0';
S.insert(get(a,2));
c = t;}}}for(auto& c : b){char t = c;for(int i =0; i <3; i ++){if(i +'0'!= c){
c = i +'0';int x =get(b,3);if(S.count(x)){
cout << x;return0;}
c = t;}}}}
Acwing2058. 笨拙的手指原题#include <iostream>#include <cstring>#include <algorithm>#include <unordered_set>using namespace std;int get(string a, int b) { int res = 0; for (int i = 0; i < a.size(); i ++ ) { res