Cod sursa(job #2204161)
Utilizator | Runcan Alexandru Alex03 | Data | 14 mai 2018 20:02:18 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main ()
{
string text;
int nr=0,nr2=0;
bool cond=false;
getline (fin,text);
for (int i=0;i<=text.length()-1;i++)
{
if (((text[i]>=97) &&(text[i]<=122)) || ((text[i]>=65) && (text[i]<=90)))
{
nr++;
cond=true;
}
else if (cond==true)
{
nr2++;
cond=false;
}
}
fout << nr/nr2;
return 0;
}