//import java.util.*;
//public class Main {
// public static void main(String[] args) {
// ArrayList<String> collection1 = new ArrayList<>();
// collection1.add("New York");
// collection1.add("Atlanta");
// collection1.add("Dallas");
// collection1.add("Madison");
//
// System.out.println("A list of cities int collection1: ");
// System.out.println(collection1);
//
// System.out.println("\nIs Dallas in collection1? " + collection1.contains("Dallas"));
//
// collection1.remove("Dallas");
// System.out.println("\n" + collection1.size() + " cities are in collection1 now");
//
// Collection<String> collection2 = new ArrayList<>();
// collection2.add("Seattle");
// collection2.add("Portland");
// collection2.add("Los Angeles");
// collection2.add("Atlanta");
//
// System.out.println("\nA list of cities in collection2:");
// System.out.println(collection2);
//
// ArrayList<String> c1 = (ArrayList<String>)(collection1.clone());
// c1.addAll(collection2);
// System.out.println("\nCities in collection1 or collection2: ");
// System.out.println(c1);
//
// c1 = (ArrayList<String>)(collection1.clone());
// c1.retainAll(collection2);
// System.out.print("\nCities in collection1 and collection2: ");
// System.out.println(c1);
//
// c1 = (ArrayList<String>)(collection1.clone());
// c1.removeAll(collection2);
// System.out.print("\nCities in collection 1, but not in 2: ");
// System.out.println(c1);
// }
//}
//import java.util.*;
//
//public class Main {
// public static void main(String[] args) {
// Collection<String> collection = new ArrayList<>();
// collection.add("New York");
// collection.add("Atlanta");
// collection.add("Dallas");
// collection.add("Madison");
//
// Iterator<String> iterator = collection.iterator();
// while (iterator.hasNext()) {
// System.out.print(iterator.next().toUpperCase() + " ");
// }
// System.out.println();
// }
//}
//import java.util.*;
//public class Main {
// public static void main(String[] args) {
// Vector<Integer> v = new Vector<Integer>();
// v.add(5);
// v.add(4);
// v.add(-1);
// v.add(2,100);
//
// Iterator<Integer> it = v.iterator();
// while(it.hasNext()) {
// int n = it.next();
// System.out.println(n);
// }
//
// int sum = 0;
// it = v.iterator();
// while (it.hasNext()) {
// int n =it.next();
// sum += n;
// }
// System.out.println("the sum of vector: " + sum);
// }
//}
//import java.util.*;
//public class Main{
// public static void main(String[] args) {
// List<Integer> arrayList = new ArrayList<>();
// arrayList.add(1);
// arrayList.add(2);
// arrayList.add(3);
// arrayList.add(1);
// arrayList.add(4);
// arrayList.add(0,10);
// arrayList.add(3,30);
//
// System.out.println("A list of integers in the array list: ");
// System.out.println(arrayList);
//
// LinkedList<Object> linkedList = new LinkedList<>(arrayList);
// linkedList.add(1, "red");
// linkedList.removeLast();
// linkedList.addFirst("green");
//
// System.out.println("Display the linked list forward:");
// ListIterator<Object> listIterator = linkedList.listIterator();
// while (listIterator.hasNext()) {
// System.out.print(listIterator.next() + " ");
// }
// System.out.println();
//
// System.out.println("Display the linked list backward:");
// listIterator = linkedList.listIterator(linkedList.size());
// while (listIterator.hasPrevious()) {
// System.out.print(listIterator.previous() + " ");
// }
// }
//}
//import java.util.*;
//public class Main{
// public static void main(String[] args) {
// ArrayList<String> a = new ArrayList<String> ();
//
// Scanner scanner = new Scanner(System.in);
// for(int i=0; i<4; i++) {
// System.out.print("enter name>>");
// String s = scanner.next();
// a.add(s);
// }
//
// for(int i=0; i<a.size(); i++) {
// String name = a.get(i);
// System.out.print(name + " ");
// }
// int longestIndex = 0;
// for(int i=1; i<a.size(); i++) {
// if(a.get(longestIndex).length() < a.get(i).length());
// longestIndex = i;
// }
// System.out.println("\nThe longest name is: " + a.get(longestIndex));
// scanner.close();
// }
//}