Submission
Status:
[PPPPPPPPPP]
Score: 100
User: detectives_conan
Problemset: 04.Corretc the wodr
Language: cpp
Time: 0.010 second
Submitted On: 2025-04-01 10:01:20
/*
Author : detective conan
Problem : Correct word
Created : 01/04/2025 10:01 UTC+7
*/
#include <bits/stdc++.h>
#define FOR(i, s, t) for(int i = s; i <= t; ++i)
#define rep(i, s, t) for(int i = s; i >= t; --i)
#define HAVE_TESTCASE true
#define vec vector
#define pil pair<int, i64>
#define pli pair<i64, int>
#define pii pair<int, int>
#define pll pair<i64, i64>
#define tiil tuple<int, int, i64>
#define tlii tuple<i64, int, int>
#define all(a) a.begin(), a.end()
#define great(a) a, vec<a>, greater<a>
#define lbv(a, m) lower_bound(all(a), m) - a.begin()
#define ubv(a, m) upper_bound(all(a), m) - a.begin()
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define F first
#define S second
#define conan cin.tie(nullptr)->sync_with_stdio(false)
#define ANS(n, s) cout << n << s
using namespace std;
using u8 = uint8_t;
using u32 = unsigned;
using i64 = int64_t;
using u64 = uint64_t;
void solve(){
string a, b, ca, cb; cin >> a >> b;
ca = a, cb = b;
sort(all(ca));
sort(all(cb));
if(ca != cb) return void(cout << "Cannot transform to " << a << '\n');
int n = a.size(), ans = 0;
FOR(i, 0, n - 1){
if(a[i] == b[i]) continue;
FOR(j, i + 1, n - 1){
if(a[i] == b[j]){
swap(b[i], b[j]);
ans++;
break;
}
}
}
ANS(ans, '\n');
}
int main(){
conan;
int t = 1;
if(HAVE_TESTCASE) cin >> t;
while(t--) solve();
}