code:
#include<bits/stdc++.h>
using namespace std;
struct poi{
double x,y;
bool operator==(poi t){
return x==t.x&&y==t.y;
}
};
double dist(poi x,poi y){
return sqrt((x.x-y.x)*(x.x-y.x)+(y.y-x.y)*(y.y-x.y));
}
double heron(poi x,poi y,poi z){
double l,a,b,c;
a=dist(x,y);
b=dist(y,z);
c=dist(x,z);
l=(a+b+c)/2;
return sqrt(l*(l-a)*(l-b)*(l-c));
}
bool OnSegment(poi a,poi b,poi c){
//点A和点B是线段的端点
double k,bb;
if(a.x==b.x){//若线段的表达式为x=(a.x)
if(c.x==a.x&&(a.y<c.y&&c.y<b.y||b.y<c.y&&c.y<a.y))return 1;
return 0;
}
else{
k=(a.y-b.y)/(a.x-b.x);
bb=a.y-k*a.x;
if(k*c.x+bb==c.y&&(a.y<c.y&&c.y<b.y||b.y<c.y&&c.y<a.y))return 1;
return 0;
}
}
int main(){
poi a,b,c,d;
scanf("(%lf,%lf)",&a.x,&a.y);
scanf("(%lf,%lf)",&b.x,&b.y);
scanf("(%lf,%lf)",&c.x,&c.y);
scanf("(%lf,%lf)",&d.x,&d.y);
if(a==d||b==d||c==d){
cout<<4;
return 0;
}
if(OnSegment(a,b,d)||OnSegment(a,c,d)||OnSegment(b,c,d)){
cout<<3;
return 0;
}
double s1,s2,s3,s4;
s1=heron(a,b,c);
s2=heron(a,b,d);
s3=heron(a,c,d);
s4=heron(b,c,d);
if(s2+s3+s4>s1)cout<<2;
else cout<<1;
}