Cod sursa(job #583682)

Utilizator krityxAdrian Buzea krityx Data 21 aprilie 2011 19:42:29
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <fstream>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	ifstream f("text.in");
	ofstream g("text.out");
	
	string s;
	int f_begin,f_end,total_len=0,nr=0;
	getline(f,s);
	f_begin=s.find_first_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
	f_end=s.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f_begin+1);
	
	while(f_begin != -1 && f_end !=-1)
	{
		total_len+=f_end-f_begin;
		nr++;
		
		f_begin=s.find_first_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f_end+1);
		f_end=s.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f_begin+1);
	}
	
	g<<total_len/nr;
	
	
	
	return 0;
}