#include #include using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll mod=1000000007999; ld inf=10000999999999900; int main(){ ll t; cin >> t; vectorans; for (ll o = 0; o < t; o++) { ll n; cin >> n; string s; cin >> s; vectorten(n+100,1); for (ll i = 1; i < ten.size(); i++) { ten[i]=ten[i-1]*997; ten[i]%=mod; } vectorhs(n); hs[0]=s[0]-'a'; for (ll i = 1; i s[0]) { x++; } } ans.push_back(x); } for (ll i = 0; i < ans.size(); i++) { cout << ans[i] << endl; } }