#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
set<string> se;
string s;
cin>>s;
int cnt=0;
for(int i=0; i<n-1; i++){
string check="";
check+=s[i];
check+=s[i+1];
se.insert(check);
}
cout<<se.size()<<endl;
}
return 0;
}
361A - Levko and Table | 5E - Bindian Signalizing |
687A - NP-Hard Problem | 1542C - Strange Function |
961E - Tufurama | 129D - String |
888A - Local Extrema | 722B - Verse Pattern |
278A - Circle Line | 940A - Points on the line |
1742C - Stripes | 1742F - Smaller |
1742B - Increasing | 1742A - Sum |
1742D - Coprime | 390A - Inna and Alarm Clock |
1398B - Substring Removal Game | 1742G - Orray |
416B - Art Union | 962A - Equator |
803B - Distances to Zero | 291A - Spyke Talks |
1742E - Scuza | 1506D - Epic Transformation |
1354G - Find a Gift | 1426F - Number of Subsequences |
1146B - Hate "A" | 1718C - Tonya and Burenka-179 |
834A - The Useless Toy | 1407D - Discrete Centrifugal Jumps |