what is wrong in my code
#include<bits/stdc++.h>
#include
using namespace std;
bool compare(string a,string b){
if(a==b.substr(0,a.length()-1)){
return a.length()>b.length();
}
return a<b;
}
int main() {
int n;
cin>>n;
string s[100];
cin.get();
for(int i=0;i<n;i++){
getline(cin,s[i]);
}
sort(s,s+n,compare);
for(int i=0;i<n;i++){
cout<<s[i]<<endl;
}
return 0;
}