Cod sursa(job #1934977)

Utilizator cris90robert@yahoo.comseretan cristian [email protected] Data 21 martie 2017 22:13:31
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.75 kb
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
int main()
{
	char text[10000];
	long long i,Lungime,k,p=0;

	fstream f("text.in",ios::in);
	f.get(text,10000);
	f.get();
	f.close();
	k=0;
	for(i=0;i<=strlen(text);i++)
	{
		if(i<strlen(text))
		{
		if((text[i]<65)||(text[i]>90)&&(text[i]<97)||(text[i]>122))
		{
			
			if((text[i-1]>=65)&&(text[i-1]<=90)||(text[i-1]>=97)&&(text[i]<=122))
			{
				
				
				k++;
				
			}
			
		}
		else
		{
			p++;
		}
		}
		if(i==strlen(text))
		{
			if((text[i-1]>=65)&&(text[i-1]<=90)||(text[i-1]>=97)&&(text[i]<=122))
			{
				k++;
				
			}
		}
			
		
	}
	Lungime=p/k;
	fstream g("text.out",ios::out);
	g<<Lungime;
	g.close();
	cout<<p<<" "<<k;
	
}