SHARE
TWEET

Untitled

a guest Dec 7th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. /*
  6.     Goal is to have all the shorter strings before the larger strings.
  7.     Otherwise if the two strings are equal compare the string that comes first in alphabetical order
  8. */
  9.  
  10. bool stringcomparator(string a, string b){ //returns true if a goes before b.
  11.     if(a.size() == b.size()){
  12.         for(int i = 0; i<a.size(); i++){
  13.             if(a[i] != b[i]){
  14.                 return a[i] < b[i];
  15.             }
  16.         }
  17.         return false;
  18.     }
  19.     else{
  20.         return a.size() < b.size();
  21.     }
  22. }
  23.  
  24. int main(){
  25.  
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top