import java.util.Scanner;
/**
* CS 170 Exercise Problem
* NOTE: YOU MUST USE while, NOT for for this problem.
*
* @author (your name goes here)
* @version (place the date here)
*/
public class XyzMiddle
{
/**
* Given a string, does "xyz" appear in the
* "middle" of the string? To define middle, we'll
* say that the number of chars to the left and right
* of the "xyz" must differ by at most one. This
* problem is harder than it looks.
*
* Inputs:
* str = the input String
*
* Some examples:
* xyzMiddle<- "AAxyzBB" -> true
* xyzMiddle<- "AxyzBB" -> true
* xyzMiddle<- "AxyzBBB" -> false
*/
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
System.out.print("The input String: ");
String str = cin.nextLine();
boolean result = false;
// PUT YOUR CODE ONLY BELOW THIS LINE
int len = str.length();
int i = 0;
while (i <= len)
{
i++;
}
// PUT YOUR CODE ONLY ABOVE THIS LINE
System.out.println(result); // DO NOT MODIFY
}
}
please help


Sign In
Create Account


Back to top









