code:
#include<bits/stdc++.h> using namespace std; int main() { int t,n,i,a; string s; cin>>t; while(t--) { int c=0; cin>>n; cin>>s; for(i=0; i<=n; i++) { if(s[i]>=48 && s[i]<=57) { a++; //this is increasing when a digit is found } else { if(a!=0) { c++; //must check this logic } a=0; //must check this logic } } cout<<c<<endl; //printing how many numbers are here } return 0; }