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 <vector>
#include <stdlib.h>
using namespace std;
const int INF = 1<<28;
struct Vec{
  double x;
  double y;
};
vector<string> split(const string &str, char delim){
  vector<string> res;
  size_t current = 0, found;
  while((found = str.find_first_of(delim, current)) != string::npos){
    res.push_back(string(str, current, found - current));
    current = found + 1;
  }
  res.push_back(string(str, current, str.size() - current));
  return res;
}

double cross(Vec &a,Vec &b){
  return a.x*b.y - a.y*b.x;
}
bool cal(int p,vector<double> &val){
  int np = p;
  int cnt = 0;
  vector<double> ans(3);
  while(cnt < 3){
    np++;
    np %=4;
    int nnp = (np+1)%4;
    if(cnt==2)nnp = (nnp+1)%4;
    Vec a;
    a.x = val[nnp*2] - val[np*2];
    a.y = val[nnp*2+1] - val[np*2+1];
    Vec b;
    b.x = val[p*2] - val[np*2];
    b.y = val[p*2+1] - val[np*2+1];
    ans[cnt] = cross(a,b);
    cnt++;
  }

  if(ans[0] < 0 && ans[1] < 0 && ans[2] < 0)return true;
  else if(ans[0] > 0 && ans[1] > 0 && ans[2] > 0)return true;
  return false;
}
int main(){
  string str;
  while(cin >> str){
    vector<string> s_v = split(str,',');
    vector<double> val(8);
    for(int i = 0;i < 8;i++){
      val[i] = stod(s_v[i]);
    } 
    int flag = 0;
    for(int i = 0;i < 4;i++){
      if(cal(i,val))flag = 1;
    }
    if(flag)cout << "NO" << endl;
    else cout << "YES" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

using ld = long double;
const ld eps = 1e-8, pi = acos(-1.0);

bool eq(ld a, ld b) {
	return abs(a - b) < eps;
}

using Point = complex<ld>;
// ?????????????????´???
class Line {
public:
	Point a, b;
};
// ??????
ld dot(Point a, Point b) {
	return real(conj(a) * b);
}

// ??????
ld cross(Point a, Point b) {
	return imag(conj(a) * b);
}

int ccw(Point a, Point b, Point c) {
	b -= a, c -= a;
	if (cross(b, c) > eps) return 1;	// a,b,c??????????¨???¨???
	if (cross(b, c) < -eps) return -1;	// a,b,c???????¨???????
	if (dot(b, c) < 0) return 2;		// c,a,b????????§??´???
	if (norm(b) < norm(c)) return -2;	// a,b,c???????????´???
	return 0;							// a,c,b???????????´???
}

// ?????´??????????????????
bool isis_ll(Line l, Line m) {
	return abs(cross(l.b - l.a, m.b - m.a)) > eps;
}

// ??´?????¨?????????????????????
bool isis_ls(Line l, Line s) {
	return (cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < eps);
}

// ??´????????????????????¨??????????????????
bool isis_lp(Line l, Point p) {
	return abs(cross(l.b - p, l.a - p)) < eps;
}

// ???????????????????????¨??????????????????
bool isis_sp(Line s, Point p) {
	return abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps;
}

// ???????????´????????????????????????????¶?
Point proj(Line l, Point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}

// ??´?????¨??´????????????
Point is_ll(Line s, Line t) {
	Point sv = s.b - s.a, tv = t.b - t.a;
	assert(cross(sv, tv) != 0);
	return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

// ????????¨?????????????????????
bool isis_ss(Line s, Line t) {
	if (isis_ll(s, t)) return isis_ls(s, t) && isis_ls(t, s);
	return isis_sp(s, t.a) || isis_sp(s, t.b) || isis_sp(t, s.a);
}

// ??´?????¨???????????¢
ld dist_lp(Line l, Point p) {
	return abs(p - proj(l, p));
}

// ??´?????¨??´???????????¢
ld dist_ll(Line l, Line m) {
	return isis_ll(l, m) ? 0 : dist_lp(l, m.a);
}

// ??´?????¨??????????????¢
ld dist_ls(Line l, Line s) {
	return isis_ls(l, s) ? 0 : min(dist_lp(l, s.a), dist_lp(l, s.b));
}

// ????????¨???????????¢
ld dist_sp(Line s, Point p) {
	Point r = proj(s, p);
	return isis_sp(s, r) ? abs(r - p) : min(abs(s.a - p), abs(s.b - p));
}

// ????????¨??????????????¢
ld dist_ss(Line s, Line t) {
	if (isis_ss(s, t)) return 0;
	return min({ dist_sp(s, t.a), dist_sp(s, t.b), dist_sp(t, s.a), dist_sp(t, s.b) });
}

int main()
{
	char c;
	ld x[4], y[4];
	while (cin >> x[0] >> c >> y[0]) {
		for (int i = 1; i < 4; i++) {
			cin >> c >> x[i] >> c >> y[i];
		}
		vector<Point> p(4);
		for (int i = 0; i < 4; i++) {
			p[i] = Point(x[i], y[i]);
		}
		bool flag = true;
		for (int i = 0; i < 2; i++) {
			if (isis_ss((Line) { p[(i + 0) % 4], p[(i + 1) % 4] }, (Line) { p[(i + 2) % 4], p[(i + 3) % 4] })) {
				flag = false;
				break;
			}
		}
		int tmp = 0;
		for (int i = 0; i < 4; i++) {
			int val = ccw(p[i], p[(i + 1) % 4], p[(i + 2) % 4]);
			if (abs(tmp) == 1 && val == -tmp) {
				flag = false;
				break;
			}
			else if (abs(val) == 1) {
				tmp = val;
			}
		}
		cout << (flag ? "YES" : "NO") << endl;
	}
	return 0;
}

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

using namespace std;

double isConvex(double xa, double ya, double xb, double yb, double x, double y)
{
	double ret;
	ret = (xa-xb)*(y-ya) + (ya-yb)*(xa-x);
	return ret;
}

int main()
{
	double xa, ya, xb, yb, xc, yc, xd, yd;
	while( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != EOF ){
		// 直線BDと線分ACが交わるか
		double bd_ac = isConvex(xb, yb, xd, yd, xa, ya)*isConvex(xb, yb, xd, yd, xc, yc);
		// 直線ACと線分BDが交わるか
		double ac_bd = isConvex(xa, ya, xc, yc, xb, yb)*isConvex(xa, ya, xc, yc, xd, yd);
		
		// bd_acが負またはac_bdが負ならば、交差している
		if( bd_ac < 0.0 && ac_bd < 0.0 ){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
#include <sstream>

using namespace std;

double EPS = 1e-12;

//誤差を考慮して足し算を行う
double add(double a, double b) {
	if( abs(a + b) < EPS * (abs(a) + abs(b))) {
		return 0;
	}

	return a + b;
}

//二次元ベクトル構造体
struct P {
	double x, y;

	P() {};
	P(double x, double y) : x(x), y(y) {
	}
	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d) {
		return P(x * d, y * d);
	}
	double dot(P p) {	//　内積
		return add(x * p.x, y * p.y);
	}
	double det(P p) {	//　外積
		return add(x * p.y, -y * p.x);
	}
};

//　線分p1-p2上に点qがあるか判定
bool on_seg(P p1, P p2, P q) {
		return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

//　直線p1-p2と直線q1-q2の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}

int ccw(P a, P b, P c) {
	a = b - a;
	b = c - b;

	if(a.det(b) < 0) {
		return -1;
	} else if(a.det(b) > 0) {
		return 1;
	}

	return 0;
}


int main() {
	
	P p[4];
	char dummy;

	while( cin >> p[0].x >> dummy >> p[0].y >> dummy >> p[1].x >> dummy >> p[1].y >> dummy >> p[2].x >> dummy >> p[2].y >> dummy >> p[3].x >> dummy >> p[3].y ) {

		int count = 0, ans = 0;
		for(int i = 0; i < 4; i++) {
			int c = ccw(p[i], p[(i + 1) % 4], p[(i + 2) % 4]);
			count += c;
			ans += abs(c);
		}

		if(ans == abs(count)) {
			cout << "YES" << endl;
		} else { 
			cout << "NO" << endl;
		}
	}
}