Pagini recente » Cod sursa (job #1849615) | Cod sursa (job #2150706) | Cod sursa (job #659484) | Cod sursa (job #243483) | Cod sursa (job #499014)
Cod sursa(job #499014)
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
char a[20];
int n = 0, c = 0;
int m = 0;
while ( fin >> a )
{
c++;
n += strlen(a);
if ( strlen(a) == 1 && a[0] == '-' )
n--, c--;
m = strlen(a);
for ( int i = 0; i < n; i++ )
if ( i > 0 && i < n && a[i] == '-' )
c++;
}
fout << n/c;
}