public class WeekendProgProb{
  public static void main(String[] ag){
    //System.out.println(twoConsecutive(1,2,2));
    //System.out.println(twoConsecutive(1,2,12));
    //System.out.println(twoConsecutive(1,3,5));
    fourHeads();
    nHeads(2);
    nHeads(5);
    //System.out.print("asdfhashasfd ".contains("has"));
  }
  public static boolean twoConsecutive(int a, int b, int c){
    return Math.abs(a-b)==1 || Math.abs(a-c)==1 || Math.abs(c-b)==1;
  }
  public static String coinFlip(){
    if ((int) (2*Math.random()) == 0){
      return ("H ");
    } else{
      return("T ");
    }
  }
  /* Below is a complicated version of what should be simple
  public static void fourHeads(){
    String counter = "";
    int cc = 0;
    while(true){
      counter += coinFlip();
      //System.out.print("\n");
      if (counter.contains("H H H H")){
        System.out.println("Yours sequence has 4 heads");
        break;
      }else if (counter.contains("T T T T")){
        System.out.println("Yours sequence has 4 tails");
        break;
      }
    }
    System.out.print(counter);
  }
  public static void nHeads(int n){
    String counter = "";
    String compareHeads = "";
    String compareTails = "";
    for(int i = 0; i <n; i++){
      compareTails+="T ";
      compareHeads+="H ";
    }
    while(true){
      counter += coinFlip();
      //System.out.print("\n");
      if (counter.contains(compareHeads)){
        System.out.println("\nYours sequence has " + n + " heads");
        break;
      }else if (counter.contains(compareTails)){
        System.out.println("\nYours sequence has " + n +" tails");
        break;
      }
    }
    System.out.print(counter);
  }*/
}

@@ -228,24 +228,26 @@
 eads();%0A    
+//
 nHeads(2);%0A 
@@ -249,16 +249,18 @@
 2);%0A    
+//
 nHeads(5
@@ -580,24 +580,24 @@
 turn(%22T %22);%0A
-
     %7D%0A  %7D%0A  
@@ -594,16 +594,580 @@
   %7D%0A  %7D%0A
+  public static void fourHeads()%7B%0A    int count = 0;%0A    while (count%3C4)%7B%0A      String dummy = coinFlip();%0A      System.out.print(dummy);%0A      if(dummy ==%22H %22)%0A        count++;%0A      else%0A        count = 0;%0A    %7D%0A    System.out.println(%22%5Cn Your sequence has had 4 heads%22);%0A  %7D%0A  public static void nHeads(int n)%7B%0A    int count = 0;%0A    while (count%3Cn)%7B%0A      String dummy = coinFlip();%0A      System.out.print(dummy);%0A      if(dummy ==%22H %22)%0A        count++;%0A      else%0A        count = 0;%0A    %7D%0A    System.out.println(%22%5Cn Your sequence has had %22+ n +%22 heads%22);%0A  %7D%0A
   /* Bel

Revise WeekendProgProb to meet standard