Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Hello {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- StringBuilder a = new StringBuilder(sc.nextLine());
- int counter = 0;
- while (counter <4) {
- StringBuilder b = new StringBuilder(sc.nextLine());
- if (a.toString().equals(b.reverse().toString())) {
- System.out.printf("User %s logged in.", a); break;
- } else {
- System.out.println("Incorrect password. Try again.");
- counter++;
- }
- if (counter == 4) {
- System.out.printf("User %s blocked!", a);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement