Cod sursa(job #623894)

Utilizator andrei_stoicaStoica Andrei Florian andrei_stoica Data 20 octombrie 2011 21:43:58
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<fstream>
#include<cstring>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
string s;
int main()
{
	int n,i,c=0,nr=0;
	bool ok=false;
	getline(in, s);
	n=s.length();
	for(i=0;i<n;i++)
		if(isalpha(s[i]))
		{
			c++;
			ok=true;
		}
		else
		{
			if(ok)
			{
				nr++;
				ok=false;
			}
		}
	out<<c/nr;
}