Skip to main content
3 of 8
deleted 61 characters in body
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 7, 166 66 63 52 bytes

boolean c(String s){return s.matches("(?s) *# .+");}

Outputs false for right and true for left.

Explanation:

boolean c(String s){  // Method with String parameter and boolean return-type
  return s.matches(   //  Return if the input matches:
    "(?s)             //  Enable multi-line regex
      *               //  " *" -> zero or more spaces
     #                //  "# " -> followed by exactly one "#" followed by a space
     .+");            //  ".+" -> followed by one or more characters (can be spaces or # or anything else)
}                     // End of method

Test code:

class M{
  static boolean c(String s){return s.matches("(?s) *# .+");}

  public static void main(String[] a){
    System.out.println(c(" ##    #\n  ##  #\n   ###\n    #\n    #\n    #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n     #\n     #\n     #"));
    System.out.println(c(" ##  #   \n  ## #  \n   ###\n    ##\n   # \n  #  \n #   "));
    System.out.println(c(" ##   #  \n  ## #  \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n   # \n  #  \n  #  "));
    System.out.println(c(" #    ## \n  #  ## \n   ###\n    #\n     #\n     #\n     #"));
  }
}

Try it here.

Output:

false
false
false
false
true
true
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384