Cod sursa(job #868153)

Utilizator TamasanPaulTamasan Paul Alexandru TamasanPaul Data 30 ianuarie 2013 18:48:37
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
#include <iostream>
#include <fstream.h>
#include <string.h>
using namespace std;
int main() {
	ifstream f("text.in");
	ofstream g("text.out");
	char prop[100];
	f.get(prop,100);
	int i, nrCuvinte=0, lungime=strlen(prop), asciiCode;
	for(i=0; i<lungime; i++) {
		asciiCode=(int)prop[i];
		if((asciiCode>64 && asciiCode< 91) || (asciiCode>96 && asciiCode<123)) {
		nrCuvinte++;
		strcpy(prop+i,prop+1+i);
		}	
	}
	asciiCode=(int)prop[lungime];
	if((asciiCode>64 && asciiCode< 91) || (asciiCode>96 && asciiCode<123)) {
		nrCuvinte++;
		g<<strlen(prop)/nrCuvinte;
		}
	else {
		nrCuvinte++;
		g<<(strlen(prop)-1)/nrCuvinte;
	}
	return 0;
}