Skip to content

Instantly share code, notes, and snippets.

@Canx
Created June 20, 2019 21:15
Show Gist options
  • Save Canx/6f4176eb9c9d771197ad7e66e140d6a7 to your computer and use it in GitHub Desktop.
Save Canx/6f4176eb9c9d771197ad7e66e140d6a7 to your computer and use it in GitHub Desktop.
package asale;
import java.text.ParseException;
import java.text.RuleBasedCollator;
import java.util.Scanner;
public class asale {
public static void main(String[] args) throws ParseException {
Scanner in = new Scanner(System.in);
String primera;
String segunda;
String rules = "< a < b < c < ch < d < e < f < g < h < i < j < k < l < ll < m < n < ñ < o < p < q < r < s < t < u < v < w < x < y < z";
RuleBasedCollator asaleCollator =new RuleBasedCollator(rules);
while (in.hasNextLine()) {
primera = in.next();
segunda = in.next();
if( asaleCollator.compare(primera, segunda) < 0)
System.out.println(primera);
else
System.out.println(segunda);
in.nextLine();
}
in.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment