Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func check(x, y, x1, y1, x2, y2 float64) float64 {
	return (x2-x1)*y - (y2-y1)*x + x1*y2 - x2*y1
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]float64, 8)
	for scanner.Scan() {
		info := strings.Split(scanner.Text(), ",")
		for j := 0; j < 8; j++ {
			a[j], _ = strconv.ParseFloat(info[j], 64)
		}
		if check(a[0], a[1], a[2],a[3], a[6], a[7])*check(a[4], a[5], a[2], a[3], a[6], a[7]) < 0 && check(a[6], a[7], a[0], a[1], a[4], a[5])*check(a[2],a[3], a[0], a[1], a[4], a[5]) < 0 {
			fmt.Println("YES")	
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <complex>
#include <cstdio>
#define EPS 1e-10
#define EQ(a,b) (abs(a - b) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))
using namespace std;

typedef complex<double> P;

double angle (double c, double b, double a) {
    return (acos((b*b + c*c - a*a) / (2*b*c)) * 180.0 / M_PI);
}

int main ()
{
    double ax, ay, bx, by, cx, cy, dx, dy;
    while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &ax, &ay, &bx, &by, &cx, &cy, &dx, &dy) != EOF) {
        P a = P(ax, by);
        P b = P(bx, by);
        P c = P(cx, cy);
        P d = P(dx, dy);

        double angles = 0.0;
        angles += angle(abs(a - d), abs(a - b), abs(d - b));
        angles += angle(abs(b - a), abs(b - c), abs(a - c));
        angles += angle(abs(c - b), abs(c - d), abs(d - b));
        angles += angle(abs(d - a), abs(d - c), abs(a - c));

        if (angles < 360.0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <sstream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

bool cross(double x[], double y[]){
    REP(i, 4){
        double v1, v2, v3;
        v1 = (x[(i)%4]-x[(i+1)%4])*(y[(i)%4]-y[(i+3)%4]) - (y[(i)%4]-y[(i+1)%4])*(x[(i)%4]-x[(i+3)%4]);
        v2 = (x[(i+1)%4]-x[(i+2)%4])*(y[(i+1)%4]-y[(i+4)%4]) - (y[(i+1)%4]-y[(i+2)%4])*(x[(i+1)%4]-x[(i+4)%4]);
        v3 = (x[(i+2)%4]-x[(i+3)%4])*(y[(i+2)%4]-y[(i+5)%4]) - (y[(i+2)%4]-y[(i+3)%4])*(x[(i+2)%4]-x[(i+5)%4]);
        if ( !(v1 < 0 && v2 < 0 && v3 < 0) && !(v1 > 0 && v2 > 0 && v3 > 0) ) {
            return false;
        }
    }
    return true;
}

int main(){
    double x[4], y[4];
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf"
        ,&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]) != EOF) {
        if (cross(x, y)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <iostream>
#include <cmath>

typedef complex<double> P;

using namespace std;

double tri2s(double xa, double ya, double xb, double yb, double xc, double yc){
     double a, b, c, s;
    
     a = sqrt((xb - xc) * (xb - xc) + (yb - yc) * (yb - yc));
     b = sqrt((xa - xc) * (xa - xc) + (ya - yc) * (ya - yc));
     c = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
    
     s = (a+b+c) / 2;

	 cout << sqrt(s * (s - a) * (s - b) * (s - c)) << endl;
    
     return sqrt(s * (s - a) * (s - b) * (s - c));
}

double p2deg(double xa, double ya, double xb, double yb, double xc, double yc){
  double a, b, c, s, cos;
    
     a = sqrt((xb - xc) * (xb - xc) + (yb - yc) * (yb - yc));
     b = sqrt((xa - xc) * (xa - xc) + (ya - yc) * (ya - yc));
     c = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));

	 cos = (b * b + c * c - a * a) / 2 * b * c;

	 return acos(cos);

}

// ツ陳シツ静シp1,p2ツづ静シツ閉ェp3,p4ツづ個古ーツ債キツ板サツ津ィ
// (n < 0)<=>ツ古ーツ債キ , (n == 0)<=>ツ陳シツ静シツ湘」, (n > 0)<=>ツ古ーツ債キツつオツづつ「ツづ按つ「  
double isIntersect(P p1, P p2, P p3, P p4){  
    return ( (p1.X-p2.X)*(p3.Y-p1.Y) + (p1.Y-p2.Y)*(p1.X-p3.X)) * ((p1.X-p2.X)*(p4.Y-p1.Y) + (p1.Y-p2.Y)*(p1.X-p4.X));  
}

int main(void){
     double x[4], y[4];
     double sq;
     double tri[4];
     bool isok = true;
    
     while(cin >> x[0]){
          cin.ignore(); cin >> y[0];
          cin.ignore(); cin >> x[1]; cin.ignore(); cin >> y[1];
          cin.ignore(); cin >> x[2]; cin.ignore(); cin >> y[2];
          cin.ignore(); cin >> x[3]; cin.ignore(); cin >> y[3];
		  
		  P a(x[0], y[0]);
		  P b(x[1], y[1]);
		  P c(x[2], y[2]);
		  P d(x[3], y[3]);
		  /*
          sq = tri2s(x[0], y[0], x[1], y[1], x[2], y[2]) + tri2s(x[0],y[0],x[2],y[2],x[3],y[3]);
         
          tri[0] = tri2s(x[0], y[0], x[1], y[1], x[2], y[2]);
          tri[1] = tri2s(x[0], y[0], x[1], y[1], x[3], y[3]);
          tri[2] = tri2s(x[0], y[0], x[2], y[2], x[3], y[3]);
          tri[3] = tri2s(x[1], y[1], x[2], y[3], x[3], y[3]);
         
          for(int i=0;i<4;i++){
               if(tri[i] > sq) isok = false;
          }
          if(tri2s(x[0],y[0],x[1],y[1],x[2],y[2]) + tri2s(x[0],y[0],x[2],y[2],x[3],y[3]) ==
			 tri2s(x[0],y[0],x[1],y[1],x[3],y[3]) + tri2s(x[2],y[2],x[1],y[1],x[3],y[3]) ){
               cout << "YES" << endl;
          }else{
               cout << "NO" << endl;
          }
          isok = true;
		  */
		  
		  if( isIntersect(a,c,b,d) > 0.0 || isIntersect(b,d,a,c) > 0.0 ){
			printf("NO\n");
		  }else{
			printf("YES\n");
		  }
	 }
	 return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

#define EPS 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
	public:
	double x, y;

	Point(double x = 0, double y = 0): x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(a * x, a * y); }
	Point operator / (double a) { return Point(x / a, y / a); }

	double abs() { return sqrt(norm()); }
	double norm() { return x * x + y * y; }

	bool operator < (const Point &p) const {
		return x != p.x ? x < p.x : y < p.y;
	}

	bool operator == (const Point &p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};

typedef Point Vector;

double cross(Vector a, Vector b) {
	return a.x*b.y - a.y*b.x;
}

double xa, ya, xb, yb, xc, yc, xd, yd;
char comma;

int main()
{
	while (cin>>xa>>comma>>ya>>comma>>xb>>comma>>yb>>comma>>xc>>comma>>yc>>comma>>xd>>comma>>yd)
	{
		Point a(xa, ya);
		Point b(xb, yb);
		Point c(xc, yc);
		Point d(xd, yd);

		Vector ab = b - a;
		Vector bc = c - b;
		Vector cd = d - c;
		Vector da = a - d;

		if (cross(ab, bc) > EPS)
		{
			//反時計回り
			if (cross(bc, cd) > EPS && cross(cd, da) > EPS && cross(da, ab) > EPS)
			{
				cout << "YES" << endl;
				continue;
			}
		} else if (cross(ab, bc) < -EPS) {
			//時計回り
			if (cross(bc, cd) > -EPS && cross(cd, da) > -EPS && cross(da, ab) > -EPS)
			{
				cout << "YES" << endl;
				continue;
			}
		}

		cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;

struct Point{double x,y;};
Point in[4];

bool solve(int num){

  int x = 0,y = 0;
  
  for(int i = 0; i < 4; i++) {
    if(in[num].x == in[i].x) x++;
    if(in[num].y == in[i].y) y++;
  }
  if(x != 2 || y != 2) return false;
  return true;
}
int main(){
  while(1){
    char c;

    for(int i = 0; i < 4; i++)
      if(i == 3) cin >> in[i].x >> c >> in[i].y;
      else if(!(cin >> in[i].x >> c >> in[i].y >> c)) return 0;


    bool ans = true;

    for(int i = 0; i < 4; i++) ans = (ans && solve(i));

    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}