Cod sursa(job #2402241)

Utilizator IoanMihaiIoan Mihai IoanMihai Data 10 aprilie 2019 15:15:24
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int n,medie,simbol,cuvinte;
string str;
string word;
int main()
{
  getline(fin,str);
  n=str.size();
  for (int i=0;i<n;i++)
   if (!isalpha(str[i]))
    {
      simbol++;
      str[i]=' ';
    }
  simbol=n-simbol;
  istringstream ss(str);
  while(ss>>word)
  {
    cuvinte++;
  }
  medie=simbol/cuvinte;
  fout<<medie<<'\n';
  return 0;
}