Pagini recente » Cod sursa (job #1917129) | Cod sursa (job #403695) | Cod sursa (job #479983) | Cod sursa (job #1759568) | Cod sursa (job #791891)
Cod sursa(job #791891)
//
// 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; getline(cin, text);
text += '!';
int len = 0, num = 0;
for(int i=0; i<text.size(); ++i)
{
if (ISALPHA(text[i]))
{
while(ISALPHA(text[i])) ++len, ++i;
++num;
}
}
cout << (num ? len/num:0);
return 0;
}