Cod sursa(job #849075)

Utilizator patratzelAlex Alex patratzel Data 6 ianuarie 2013 10:48:04
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 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++;
        }
        fout<<l/c;
        
    return 0;
}