Cod sursa(job #1677069)
| Utilizator | Data | 6 aprilie 2016 12:26:46 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.69 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{int o=0,c=0,i,n;
char s[1001];
f.getline(s,1001);
n=strlen(s);
if (('a'<=s[0]&&s[0]<='z')||('A'<=s[0]&&s[0]<='Z'))
{
o++;
}
for (i=1;i<=n;i++)
{
if (('a'<=s[i]&&s[i]<='z')||('A'<=s[i]&&s[i]<='Z'))
{
o++;
}
else
{
if (('a'<=s[i-1]&&s[i-1]<='z')||('A'<=s[i-1]&&s[i-1]<='Z'))
{
c++;
}
}
}
if (('a'<=s[n]&&s[n]<='z')||('A'<=s[n]&&s[n]<='Z'))
{
c++;
}
g<<o/c;
return 0;
}
