Submission
Status:
[PPPPPPPPPP]
Score: 100
User: fluke
Problemset: 04.Corretc the wodr
Language: cpp
Time: 0.005 second
Submitted On: 2025-04-04 21:32:59
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define emb emplace_back
#define em emplace
#define DB cout<<"\n";system("pause");
#define sp <<" "<<
#define all(x) x.begin(),x.end()
using namespace std;
int di[] = {1,0,-1,0,1,1,-1,-1};
int dj[] = {0,1,0,-1,1,-1,1,-1};
int inf = 1e9;
int mod = 1e9 + 7;
ll INF = 1e18;
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int q;
cin>>q;
while(q--){
string a,b;
cin>>a>>b;
int suma = 0 , sumb = 0;
for(auto x : a)suma += x;
for(auto x : b)sumb += x;
if(suma != sumb){
cout<<"Cannot transform to "<<a<<"\n";
continue;
}
int move = 0;
for(int i=0;i<a.size();i++){
for(int j=i;j<a.size();j++){
if(i == j && a[i] == b[j])break;
if(a[i] == b[j]){
move++;
swap(b[i] , b[j]);
break;
}
}
}
cout<<move<<"\n";
}
}