/** * Author: Josiah Yoder * Class: SE1051-011 * Lesson: Week 5, Day 3 */ import java.util.Scanner; public class Example051_5_3 { public static void main(String[] ignored){ Scanner in = new Scanner(System.in); // String str = "aa*aa"; // aa String str = "ab*cd"; // ad int i; String result = ""; // Partial solution. Does not check beginning and end cases. // As a result, this will nearly always crash. // But it also is the start of a correct program. for(i=0; i < str.length() ; i++) { if(str.charAt(i)!='*' && str.charAt(i+1)!='*' && str.charAt(i-1)!='*') { result += str.charAt(i); } } System.out.println(result); } }