1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 #define inf 0x7fffffff 5 #define faster ios::sync_with_stdio(0);cin.tie(0) 6 7 inline ll read() 8 { 9 int x=0,f=1;char ch=getchar(); 10 while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 11 while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 12 return x*f; 13 } 14 15 /********************************************************************/ 16 17 const int maxn = 1000000+7; 18 int n; 19 char s[2]; 20 char ch[maxn]; 21 22 int main(){ 23 int t; 24 t = read(); 25 while(t--){ 26 n = read(); 27 scanf("%s", s); 28 scanf("%s", ch); 29 int ans = 0; 30 int flag = 0; //是头 31 for(int i = 0;i < n;i++){ 32 if(flag == 0){ 33 int x = abs(s[0] - ch[i]); 34 //cout << "x : " << x << endl; 35 if(x == 0) 36 continue; 37 if(x < 10){ 38 ans = 1; 39 } 40 else 41 ans = 2; 42 flag = 1; 43 continue; 44 } 45 else 46 ans += 2; 47 } 48 if(ans == 0) 49 ans = 1; 50 printf("%d ", ans); 51 } 52 return 0; 53 }