Cod sursa(job #1779839)
Utilizator | Data | 15 octombrie 2016 17:20:31 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 1.01 kb |
#include <fstream>
using namespace std;
int i,l,t;
char c[500005];
int main()
{
ifstream f("text.in");
ofstream g("text.out");
f.getline(c,500005);
i=1;
if(c[0]>='a'&&c[0]<='z')
{
l=1;
t=1;
}
if(c[0]>='A'&&c[0]<='Z')
{
l=1;
t=1;
}
while(c[i])
{
if(c[i]>='a'&&c[i]<='z')
{
l++;
t++;
if(c[i-1]>='a'&&c[i-1]<='z')
{
t--;
}
else
if(c[i-1]>='A'&&c[i-1]<='Z')
{
t--;
}
}
if(c[i]>='A'&&c[i]<='Z')
{
l++;
t++;
if(c[i-1]>='a'&&c[i-1]<='z')
{
t--;
}
else
if(c[i-1]>='A'&&c[i-1]<='Z')
{
t--;
}
}
i++;
}
g<<l/t<<'\n';
f.close(); g.close();
return 0;
}