Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- /*
- Goal is to have all the shorter strings before the larger strings.
- Otherwise if the two strings are equal compare the string that comes first in alphabetical order
- */
- bool stringcomparator(string a, string b){ //returns true if a goes before b.
- if(a.size() == b.size()){
- for(int i = 0; i<a.size(); i++){
- if(a[i] != b[i]){
- return a[i] < b[i];
- }
- }
- return false;
- }
- else{
- return a.size() < b.size();
- }
- }
- int main(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement