#include<bits/stdc++.h>
using namespace std;
bool compare(string a ,string b){
if(a.size() <= b.size() && b.substr(0,a.size()) == a) return false;
else if(a.size() => b.size() && a.substr(0,b.size()) == b) return true;
else return b>a;
}
int main() {
int n;
cin>>n;
string *arr = new string[n];
for(int i=0; i<n; i++){
cin>>arr[i];
}
sort(arr,arr+n,compare);
for(int j=0; j<n;j++){
cout<<arr[j]<<endl;
}
return 0;
}
it is showing error as:
Compiling failed with exitcode 1, compiler output:
prog.cpp: In function ‘bool compare(std::__cxx11::string, std::__cxx11::string)’:
prog.cpp:6:19: error: expected primary-expression before ‘>’ token
else if(a.size() => b.size() && a.substr(0,b.size()) == b) return true;
^
prog.cpp:8:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^