Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solucion Reto #2 Java #1360

Open
CAPB11 opened this issue Sep 29, 2024 · 0 comments
Open

Solucion Reto #2 Java #1360

CAPB11 opened this issue Sep 29, 2024 · 0 comments

Comments

@CAPB11
Copy link

CAPB11 commented Sep 29, 2024

String c1;
String c2;
boolean b;

	Scanner r = new Scanner(System.in);

	System.out.println("Ingrese una palabra");
	c1 = r.next();

	System.out.println("Ingrese otra palabra");
	c2 = r.next();

	if ((c1.length() != c2.length())) {
		b = false;
		System.out.println(b);
	} else {
		char[] a1 = c1.toCharArray();
		char[] a2 = c2.toCharArray();

		Arrays.sort(a1);
		Arrays.sort(a2);

		if (Arrays.equals(a1, a2)) {
			b = true;
			System.out.println(b);
		} else {
			b = false;
			System.out.println(b);
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant