Cod sursa(job #709342)
Utilizator | Data | 7 martie 2012 23:51:57 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <iostream>
#include <string>
#include <fstream>
#include <math.h>
using namespace std;
int main(){
ifstream fin("text.in");
ofstream fout("text.out");
string s;
getline(fin,s);
int charszam=0,szoszam=0;
bool ok=false;
for (int i=0;i<s.length();i++){
if((s[i]>='a')&&(s[i]<='z')||(s[i]>='A')&&(s[i]<='Z')){
charszam++;
ok=true;
}else if(ok){
szoszam++;
ok=false;
}
}
double x;
if(!szoszam==0){
x=charszam/szoszam;
}else{
x=0;
}
fout<<floor (x);
fout.close();
}