Pagini recente » Cod sursa (job #832984) | Cod sursa (job #592591) | Cod sursa (job #110761) | Cod sursa (job #1284505) | Cod sursa (job #2469029)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
int nrcuv = 1, nrlit = 0;
char chestie[999999];
fin.getline(chestie, 999999);
for (int i = 0; i <= strlen(chestie); i++)
{
if ((chestie[i] == ' ' && (chestie[i-1] >= 'a' && chestie[i-1] <= 'z' || chestie[i-1] >= 'A' && chestie[i-1] <= 'Z') && (chestie[i+1] >= 'a' && chestie[i+1] <= 'z' || chestie[i+1] >= 'A' && chestie[i+1] <= 'Z')) || chestie[i] == '-' && (chestie[i-1] >= 'a' && chestie[i-1] <= 'z' || chestie[i-1] >= 'A' && chestie[i-1] <= 'Z') && (chestie[i+1] >= 'a' && chestie[i+1] <= 'z' || chestie[i+1] >= 'A' && chestie[i+1] <= 'Z')) nrcuv++;
if (chestie[i]>='a'&&chestie[i]<='z'||chestie[i]>='A'&&chestie[i]<='Z') nrlit++;
}
fout << nrlit/nrcuv;
return 0;
}