Cod sursa(job #849781)

Utilizator patratzelAlex Alex patratzel Data 7 ianuarie 2013 17:01:49
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include <fstream>
#include <string.h>
#include <ctype.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char s[1000];
unsigned c,l;
int main()
{   fin.get(s,1000);
    for(unsigned w=0;w<strlen(s);w++)
        { if((s[w]>='a'&&s[w]<='z')||(s[w]>='A'&&s[w]<='Z'))
                l++;
        }
    unsigned q=0,z=0;
    while(q<strlen(s))
        { if(ispunct(s[q])!=0)
           s[q]=' ';
         q++;
        }
    while(z<strlen(s))
        { if(s[z]!=' ')
            { while(s[z]!=' ')
                z++;
                c++;
            }
            z++;
        }
     if(c==0)
			 fout<<"0";
	 else
		fout<<l/c;
         
    return 0;
}