Pagini recente » Cod sursa (job #46656) | Cod sursa (job #387534) | Cod sursa (job #1907895) | Cod sursa (job #592175) | Cod sursa (job #791894)
Cod sursa(job #791894)
//
// main.cpp
// a1
//
// Created by abc on 9/20/12.
// Copyright (c) 2012 abc. All rights reserved.
//
# include <iostream>
# include <cstdio>
# include <cstdlib>
# include <iomanip>
# include <cmath>
# include <map>
# include <vector>
# include <set>
using namespace std;
# define ISALPHA(Q) (('a' <= Q && Q <= 'z') || ('A' <= Q && Q <= 'Z'))
# define ISDIGIT(a) ('0' <= a && a <= '9')
# define TODIGIT(a) (a - '0')
typedef unsigned char U8;
typedef long long LONG;
void init()
{
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
}
int main(int argc, const char * argv[])
{
init();
string text, t;
while(getline(cin, t)) text += t;
text += '!';
LONG len = 0, num = 0;
for(size_t i=0; i<text.size(); ++i)
{
if (ISALPHA(text[i]))
{
while(ISALPHA(text[i])) ++len, ++i;
++num;
}
}
cout << (num ? len/num:0);
return 0;
}