Cod sursa(job #1661874)
| Utilizator | Data | 24 martie 2016 11:38:16 | |
|---|---|---|---|
| Problema | Text | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[1002];
int l,k,nrcuv=0,lcuv=0;
int main(){
while (f>>text){
l=strlen(text);
k=0;
for (int i=0;i<l;i++)
if (text[i]=='-' || text[i]==',' || text[i]=='.' || text[i]==' ' || text[i]=='?' || text[i]=='!')
k++;
if (l>k){
nrcuv=k+1;
lcuv=l-k;
}
}
g<<lcuv/nrcuv;
f.close();
g.close();
return 0;
}
