Cod sursa(job #1502692)

Utilizator ArkkAlexandru Arkk Data 14 octombrie 2015 22:12:16
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <iostream>
#include <fstream>
using namespace std;
int a,b,c,d,n,i,j;
string s;
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    getline(f,s);
    n=s.length();
    a=n;
    b=0;
    c=0;
    while((s[c]==' ') or (s[c]=='.') or (s[c]==',') or (s[c]==';') or (s[c]=='-')){a--;c++;}
    for(i=c;i<=n-2;i++)
    {
        if((s[i]==' ') or (s[i]=='.') or (s[i]==',') or (s[i]==';') or (s[i]=='-')) {a--;b++;
            if((s[i+1]==' ') or (s[i+1]=='.') or (s[i+1]==',') or (s[i+1]==';') or (s[i+1]=='-')) {a--;i++;}}

    }
    b++;a--;
        d=a/b;
        cout<<d;
    return 0;
}