Pagini recente » Cod sursa (job #1913917) | Cod sursa (job #2876770) | Cod sursa (job #1388420) | Cod sursa (job #609557) | Cod sursa (job #2567013)
#include <fstream>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
int main()
{
int words = 0;
int cnt=0;
char c;
bool pci, ci;
cin>>c;
pci = ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
if(pci)
words++, cnt++;
while(cin.get(c)) {
// cout << c << " ";
ci = ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
if(ci)
cnt++;
if(!pci && ci)
words++;
pci = ci;
}
cout << cnt / words;
return 0;
}