import java.util.Scanner;

public class ${CLASS_NAME}{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String[] site = new String[100];
        String[] username = new String[100];
        String[] password = new String[100];
        int count = 0;
        int choice;
        String key;

        do {
            System.out.println("\n===== Password Manager =====");
            System.out.println("1. Add Record");
            System.out.println("2. View All Records");
            System.out.println("3. Search Record");
            System.out.println("4. Update Record");
            System.out.println("5. Delete Record");
            System.out.println("6. Exit");
            System.out.print("Please choose an option: ");
            choice = sc.nextInt();

            switch (choice) {

                case 1:
                    if (count >= 100) {
                        System.out.println("Cannot add more items. Storage is full.");
                        break;
                    }
                    System.out.print("Enter Site: ");
                    sc.nextLine();
                    site[count] = sc.nextLine();
                    System.out.print("Enter Username: ");
                    sc.nextLine();
                    username[count] = sc.nextLine();
                    System.out.print("Enter Password: ");
                    sc.nextLine();
                    password[count] = sc.nextLine();
                    count++;
                    System.out.println("Added successfully!");
                    break;

                case 2:
                    if (count == 0) {
                        System.out.println("No Records Found.");
                    }
                    else {
                        System.out.println("\n===== Records (Site | Username | Password) =====");
                        for (int i = 0; i < count; i++) {
                            System.out.println((i + 1) + ". " + site[i] + " | " + username[i] + " | " + password[i]);
                        }
                    }
                    break;

                case 3:
                    System.out.print("Enter Site to Search: ");
                    sc.nextLine();
                    key = sc.nextLine();
                    {
                        boolean found = false;
                        for (int i = 0; i < count; i++) {
                            if (site[i].equals(key)) {
                                System.out.println("Found: " + site[i] + " | " + username[i] + " | " + password[i]);
                                found = true;
                            }
                        }
                        if (!found) System.out.println("No matching record was found.");
                    }
                    break;

                case 4:
                    System.out.print("Enter Site to Update: ");
                    sc.nextLine();
                    key = sc.nextLine();
                    {
                        boolean found = false;
                        for (int i = 0; i < count; i++) {
                            if (site[i].equals(key)) {
                            System.out.print("Enter New Site: ");
                            sc.nextLine();
                            site[i] = sc.nextLine();
                            System.out.print("Enter New Username: ");
                            sc.nextLine();
                            username[i] = sc.nextLine();
                            System.out.print("Enter New Password: ");
                            sc.nextLine();
                            password[i] = sc.nextLine();
                                System.out.println("Updated successfully!");
                                found = true;
                                break;
                            }
                        }
                        if (!found) System.out.println("No matching record was found.");
                    }
                    break;

                case 5:
                    System.out.print("Enter Site to Delete: ");
                    sc.nextLine();
                    key = sc.nextLine();
                    {
                        boolean found = false;
                        for (int i = 0; i < count; i++) {
                            if (site[i].equals(key)) {
                                for (int j = i; j < count - 1; j++) {
                                    site[j] = site[j + 1];
                            username[j] = username[j + 1];
                            password[j] = password[j + 1];
                                }
                                count--;
                                System.out.println("Deleted successfully!");
                                found = true;
                                break;
                            }
                        }
                        if (!found) System.out.println("No matching record was found.");
                    }
                    break;

                case 6:
                    System.out.println("Thank You for Using Password Manager.");
                    break;

                default:
                    System.out.println("Invalid Choice.");
            }

        } while (choice != 6);

        sc.close();
    }
}