Cod sursa(job #2243917)
Utilizator | Data | 21 septembrie 2018 18:24:43 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char c;
int nrc, nrl;
bool vali(char a)
{
return (int(a)>='a' && int(a)<='z') || (int(a)>='A' && int(a)<='Z');
}
int main()
{
bool ok=0;
while(f.get(c))
{
if(vali(c))
{
nrl++;
ok=1;
}
else
{
if(ok)
nrc++;
ok=0;
}
}
g<<nrl<<' '<<nrc<<'\n';
g<<nrl/nrc;
}