Help me in solving STRCOMPARE problem

My issue

My code

#include <iostream>
// #define int long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin>>t;
	while(t--)
	{
	int n;
	cin>>n;
	string s1;
	string s2;
	cin>>s1;
	cin>>s2;
	int count=0;
	for(int i=0;i<n;i++)
	{
	    for(int j=0;j<n;j++)
	    {
	        if(s1[i]<s2[j])
	        {
	            count++;
	            break;
	        }
	        else
	        {
	            continue;
	        }
	    }
	}
	  
cout <<count<<endl;
}
	  
	return 0;
}

Problem Link: STRCOMPARE Problem - CodeChef

@neelakshi12 well i looked upon your code , what i felt is u have still not understood the question clearly.
I have solved it in a very simple manner
I have pasted my code below

hope this helps!!

include <bits/stdc++.h>
define rep(i, start, end) for(int i = start; i<end; i++)
using namespace std;

int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
string s,r;
cin>>s>>r;
int ans=0,cnt=0;
rep(i,0,n){
if(s[i]<r[i]) ans+=(cnt+1), cnt=0;
else if(s[i]==r[i]) cnt++;
else cnt=0;
}
cout<<ans<<endl;
}
return 0;
}