C++ <s>226</s> <s>224</s> 222
===========

I know I'm kinda late for the party, but this seemed like a fun problem and lack of entries using C-family languages bothered me.

So here's a C++ function using no regexp or string substitution, just some simple math:

    void f(){char c;int o=0,i,j;while(cin>>c)c=='p'||c==80?cin.ignore(9,58):cin.unget(),cin>>i>>c&&c==45?cin>>j>>c&&(c=='e'||c=='o')?cin.ignore(9,44),c=='e'?i+=i&1,j+=!(j&1):(i+=!(i&1),j+=j&1),o+=(j-i)/2:o+=j-i:0,++o;cout<<o;}

**Ungolfed**:

    void f()
    {
      char c;
      int o=0,i,j;
      while(cin>>c)
        c=='p'||c==80?cin.ignore(9,58):cin.unget(),
        cin>>i>>c&&c==45?
          cin>>j>>c&&(c=='e'||c=='o')?
            cin.ignore(9,44),
            c=='e'?
              i+=i&1,j+=!(j&1)
            :(i+=!(i&1),j+=j&1),
            o+=(j-i)/2
          :o+=j-i
        :0,
        ++o;
      cout<<o;
    }

I didn't say it would be readable, now did I? :) Ternary operators are hell. I tried my best to (sort of) format it, though, so I hope it helps at least a little bit.

**Usage**:

    #include <iostream>
    using namespace std;
    
    void f(){char c;int o=0,i,j;while(cin>>c)c=='p'||c==80?cin.ignore(9,58):cin.unget(),cin>>i>>c&&c==45?cin>>j>>c&&(c=='e'||c=='o')?cin.ignore(9,44),c=='e'?i+=i&1,j+=!(j&1):(i+=!(i&1),j+=j&1),o+=(j-i)/2:o+=j-i:0,++o;cout<<o;}
    
    int main()
    {
      f();
    }