I have run the code but test case 1 not pass
this is my code
#include
#include
#include
using namespace std;
bool comp(string a,string b){
if(a[0]==b[0]){
return a.length() >b.length();
}
return a<b;// Assending order
}
int main(){
int n;
cin >>n;
string a[1000];
cin.get();
for(int i=0;i<n;i++){
getline(cin,a[i]);
}
sort(a,a+n,comp);
for(int i=0;i<n;i++){
cout << a[i] << endl;
}
return 0;
}