Cod sursa(job #855643)

Utilizator StefanFaibla blah StefanFai Data 15 ianuarie 2013 13:31:05
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include<fstream>
using namespace std;
char x=' ',y='\0',z='\0';
int t_c,t_cuv;
int main(){
	ifstream f("text.in");
	
	while(f.good()){
		x=f.get();
		if(y=='\0'&&z=='\0')
			y=x;
		else {
			z=y;
			y=x;
		}
		if(strchr("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM",y))
			t_c++;
		else if(strchr("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM",y)==0&&strchr("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM",z)&&z!='\0')
			t_cuv++;
	}
	f.close();
	ofstream g("text.out");
	g<<t_c/t_cuv;
	g.close();
	return 0;
}