package bgstudents; import java.lang.reflect.Array; import java.util.*; import java.util.stream.Collectors; public class main { public static void main(String[] args) { Scanner input = new Scanner(System.in); List Lessons = Arrays.stream(input.nextLine().split(", ")).collect(Collectors.toList()); String newInput = input.nextLine(); while(!newInput.equalsIgnoreCase("course start")){ List Split = Arrays.stream(newInput.split("\\:+")).collect(Collectors.toList()); String Command = Split.get(0); switch(Command){ case"Add": String lessonTitle = Split.get(1); if(!Lessons.contains(lessonTitle)){ Lessons.add(lessonTitle); } break; case"Insert": lessonTitle = Split.get(1); int Index = Integer.parseInt(Split.get(2)); if(!Lessons.contains(lessonTitle) && (Index>=0 && Index