package ro.devmind; import java.util.Scanner; public class Ex1 { public static int countOccurrencesIgnoreCase(String[] array, String key) { int counter = 0; for (int i = 0; i < array.length; i++) { if (array[i].equalsIgnoreCase(key)) { counter++; } } return counter; } public static void main(String[] args) { // Test 1 String[] array1 = {}; String key1 = "aKey"; System.out.println("Test 1: " + countOccurrencesIgnoreCase(array1, key1)); // Test 2 String[] array2 = {"Java", "C", "Python", "JAVA", "perl", "C#", "java"}; String key2 = "JAVA"; System.out.println("Test 2: " + countOccurrencesIgnoreCase(array2, key2)); // Test 3 String key3 = "JA VA"; System.out.println("Test 3: " + countOccurrencesIgnoreCase(array2, key3)); // Test 4 String key4 = "TensorFlow"; System.out.println("Test 4: " + countOccurrencesIgnoreCase(array2, key4)); } }