problem link : https://codeforces.com/problemset/problem/1520/B
I understood the problem and i known the logic still program is giving wrong answer.
using namespace std;
using ll = long long;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
ll count=0;
for(ll i=1;i<=n;i++)
{
ll temp = i;
while(temp<=n)
{
temp = (temp*10)+i;
count++;
}
}
cout<<count<<"\n";
}
}