Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- class Mar18 {
- static int caseNum = 1;
- public static void main(String[] args) {
- System.out.println("Please input two strings. Type 'END' to quit.");
- Scanner in = new Scanner(System.in);
- String input1 = in.nextLine();
- if(input1.toLowerCase().equals("end")){
- System.out.println("Have a nice Day.");
- }
- String input2 = in.nextLine();
- char[] c1 = input1.toLowerCase().toCharArray();
- char[] c2 = input2.toLowerCase().toCharArray();
- Arrays.sort(c1);
- Arrays.sort(c2);
- if(Arrays.equals(c1, c2)){
- System.out.println("Case " + caseNum + ": same.");
- }else{
- System.out.println("Case " + caseNum + ": Different.");
- }
- caseNum++;
- main(null);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement