Cod sursa(job #563313)
| Utilizator | Data | 24 martie 2011 22:04:00 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
int main(){
ifstream fin("text.in");
ofstream fout("text.out");
char a[1000];
fin.getline(a,1000);
int nr=0;
for(int i=1;i<=strlen(a)-1;i++)
if((a[i]>='a' && a[i]<='z') || (a[i]>='A' & a[i]<='Z'))
nr++;
char *p;
int c=0;
p=strtok(a," ");
while(p!=NULL)
{
c++;
p=strtok(NULL," ");
}
cout<<c;
cout<<'\n'<<nr;
fout<<nr/c;
return 0;
}
