Pagini recente » Cod sursa (job #613222) | Cod sursa (job #1082205) | Cod sursa (job #517032) | Junior Challenge 2008, Clasament | Cod sursa (job #2515047)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char text[1024*1024+1];
int nrl, nrc;
int main()
{
fin.getline(text,1024*1024+1);
if((text[0]>='A' && text[0]<='Z') || (text[0]>='a' && text[0]<='z'))
nrl++;
for(int i=1;i<strlen(text);i++)
if(((text[i-1]>='A' && text[i-1]<='Z') || (text[i-1]>='a' && text[i-1]<='z')) && !isalpha(text[i]))
nrc++;
else if((text[i]>='A' && text[i]<='Z') || (text[i]>='a' && text[i]<='z'))
nrl++;
fout<<nrl/nrc;
return 0;
}