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>

using namespace std;

int main()
{
	double x[4], y[4];
	char dummy;
	
	while ( cin >> x[0] >> dummy >> y[0] >> dummy >> x[1] >> dummy >> y[1] >> dummy >> x[2] >> dummy >> y[2] >> dummy >> x[3] >> dummy >> y[3] ) {
		bool isClockwise;
		if ( x[0] != x[1] ) {
			isClockwise = ((y[2] - y[0]) * (x[1] - x[0]) < (y[1] - y[0]) * (x[2] - x[0]));
		}
		//else if ( x[0] > x[1] ) {
		//	isClockwise = ((y[2] - y[0]) * (x[1] - x[0]) > (y[1] - y[0]) * (x[2] - x[0]));
		//}
		else {
			isClockwise = ((x[2] > x[1]) == (y[1] > y[0]));
		}
		
		//cout << "isClockwise = " << isClockwise << endl;
		
		bool isConvex = true;
		for (int i=1; i<4; i++) {
			if ( x[i] != x[(i+1)%4] ) {
				if ( ((y[(i+2)%4] - y[i]) * (x[(i+1)%4] - x[i]) < (y[(i+1)%4] - y[i]) * (x[(i+2)%4] - x[i])) != isClockwise ) { isConvex = false; break; }
			}
			//else if ( x[i] > x[(i+1)%4] ) {
			//	if ( ((y[(i+2)%4] - y[i]) * (x[(i+1)%4] - x[i]) > (y[(i+1)%4] - y[i]) * (x[(i+2)%4] - x[i])) != isClockwise ) { isConvex = false; break; }
			//}
			else {
				if ( ( (x[(i+2)%4] > x[(i+1)%4]) == (y[(i+1)%4] > y[i]) ) != isClockwise ) { isConvex = false; break; }
			}
			//cout << i << endl;
		}
		if (isConvex) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

struct Vector { double x; double y; };

Vector sub_vector(const Vector& a, const Vector& b) {
	Vector ret;
	ret.x = a.x - b.x;
	ret.y = a.y - b.y;
	return ret;
}

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) {
		Vector A, B, C, D;
		A.x = ax; A.y = ay;
		B.x = bx; B.y = by;
		C.x = cx; C.y = cy;
		D.x = dx; D.y = dy;

		Vector AB = sub_vector(B, A);
		Vector BD = sub_vector(D, B);
		Vector BC = sub_vector(C, B);
		Vector CD = sub_vector(D, C);
		Vector CA = sub_vector(A, C);
		Vector AD = sub_vector(D, A);

		double c1 = AB.x * BD.y - AB.y * BD.x;
		double c2 = BC.x * CD.y - BC.y * CD.x;
		double c3 = CA.x * AD.y - CA.y * AD.x;

		if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) printf("NO\n");
		else {
			Vector DA = sub_vector(A, D);
			Vector AC = sub_vector(C, A);
			Vector DC = sub_vector(C, D);
			c1 = AB.x * BC.y - AB.y * BC.x;
			c2 = BD.x * DC.y - BD.y * DC.x;
			c3 = DA.x * AC.y - DA.y * AC.x;
			if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) printf("NO\n");
			else {
				Vector AC = sub_vector(C, A);
				Vector CB = sub_vector(B, C);
				Vector DB = sub_vector(B, D);
				c1 = AC.x * CB.y - AC.y * CB.x;
				c2 = CD.x * DB.y - CD.y * DB.x;
				c3 = DA.x * AB.y - DA.y * AB.x;
				if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) printf("NO\n");
				else {
					Vector BA = sub_vector(A, B);
					c1 = BC.x * CA.y - BC.y * CA.x;
					c2 = CD.x * DA.y - CD.y * DA.x;
					c3 = DB.x * BA.y - DB.y * BA.x;
					if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) printf("NO\n");
					else printf("YES\n");
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstdio>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

int main() {
  double a,b,c,d,e,f,g,h;
  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &a,&b,&c,&d,&e,&f,&g,&h) == 8) {
    P aa(a,b), bb(c,d), cc(e,f), dd(g,h);
    if ( ccw(aa,bb,cc)==1&&ccw(bb,cc,dd)==1&&ccw(cc,dd,aa)==1&&ccw(dd,aa,bb)==1 || ccw(aa,bb,cc)==-1&&ccw(bb,cc,dd)==-1&&ccw(cc,dd,aa)==-1&&ccw(dd,aa,bb)==-1)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
double xa,ya,xb,yb,xc,yc,xd,yd;
int a,cnt,cnt2;
char ch;
double di(double x,double y){
  return sqrt(x*x+y*y);
}
int f(double x1,double y1,double x2,double y2){
  double a = x1*y2 - x2*y1;
  //a = (a)/di(x1,y1)/di(x2,y2);
  //cout<<a<<endl;
  if(a>0.0)return 1;
  else return -1;
  //return 0;
}
int main(){
  while(cin>>xa>>ch>>ya>>ch>>xb>>ch>>yb>>ch>>xc>>ch>>yc>>ch>>xd>>ch>>yd){
    a=f(xa-xb,ya-yb,xb-xc,yb-yc);
    if(a>0)cnt++;
    else if(a==0)cnt++,cnt2++;
    else cnt2++;

    a=f(xb-xc,yb-yc,xc-xd,yc-yd);
    if(a>0)cnt++;
    else if(a==0)cnt++,cnt2++;
    else cnt2++;

    a=f(xc-xd,yc-yd,xd-xa,yd-ya);
    if(a>0)cnt++;
    else if(a==0)cnt++,cnt2++;
    else cnt2++;

    a=f(xd-xa,yd-ya,xa-xb,ya-yb);
    if(a>0)cnt++;
    else if(a==0)cnt++,cnt2++;
    else cnt2++;

    if(cnt==4||cnt2==4)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>

class Point2D {
	double m_x, m_y;
public:
	Point2D(double x, double y) :
		m_x(x), m_y(y)
	{}
	Point2D(const Point2D &p) :
		m_x(p.x()), m_y(p.y())
	{}
	double x() const { return m_x; }
	double y() const { return m_y; }
};

Point2D operator-(const Point2D &a, const Point2D &b) {
	return Point2D(a.x() - b.x(), a.y() - b.y());
}

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

bool isIntersected(const Point2D &p1, const Point2D &p2, const Point2D &q1, const Point2D &q2) {
	const Point2D p = p2 - p1, q = q2 - q1;
	return cross(p, q1 - p1) * cross(p, q2 - p1) <= 0 && cross(q, p1 - q1) * cross(q, p2 - q1) <= 0;
}

std::vector<std::string> split(std::string &str, char delim) {
	std::vector<std::string> result;
	std::istringstream is(str);
	std::string buf;
	while (getline(is, buf, delim)) {
		result.push_back(buf);
	}
	return result;
}

bool inputDataSet(std::vector<Point2D> *p) {
	std::string line;
	if (!getline(std::cin, line)) { return false; }
	const std::vector<std::string> tokens(split(line, ','));
	if (tokens.size() != 8) { return false; }
	std::vector<double> ds;
	for (std::vector<std::string>::const_iterator it = tokens.begin(); it != tokens.end(); ++it) {
		std::istringstream is(*it); double x;
		is >> x;
		ds.push_back(x);
	}
	p->clear();
	for (int i = 0; i < 8; i += 2) {
		p->push_back(Point2D(ds[i], ds[i + 1]));
	}
	return true;
}

int main() {
	std::vector<Point2D> p;
	while (inputDataSet(&p)) {
		if (p.size() < 4) { continue; }
		std::cout << (isIntersected(p[0], p[2], p[1], p[3]) ? "YES" : "NO") << std::endl;
	}
	return 0;
}