Cod sursa(job #890692)

Utilizator Dan_RadulescuRadulescu Dan Dan_Radulescu Data 25 februarie 2013 11:20:47
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include<fstream>
#include<string.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int i,n,t,k,nr;
char s[1000];
int main(){
   fin.get(s,1000,'\n');
   fin.get();
   fin.close();
   n=strlen(s);
   k=n;
   for (i=0;i<n;i++)
     if ((int)s[i]<65)
         k=k-1;
   for (i=1;i<n;i++)
     if ((int)s[i]>=65){
        t=i;
        break;
     }
   nr=1;
   for (i=t+1;i<n;i++)
     if (s[i]==' ' || s[i]=='-') nr=nr+1;
   fout<<k/nr;
   fout.close();
   return 0;
}