Pagini recente » Cod sursa (job #2030004) | Cod sursa (job #2887618) | Cod sursa (job #1901655) | Cod sursa (job #2547615) | 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;
}