Cod sursa(job #2740150)
Utilizator | Darius Chitu Darius_C | Data | 11 aprilie 2021 17:50:43 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.65 kb |
#include <iostream>
#include <fstream>
#include <cctype>
#include <cstring>
#include <algorithm>
std::ifstream fin("text.in");
std::ofstream fout("text.out");
using namespace std;
void Solve()
{
char ch,prev;
long long Nr_Letters=0, Nr_Words=0;
while(fin.get(ch))
{
int ascii_ch,ascii_prev;
ascii_ch=(int)ch, ascii_prev=(int)prev;
if(isalpha(ch))
{
Nr_Letters++;
if(!isalpha(prev))
Nr_Words++;
}
prev=ch;
}
fout<< Nr_Letters/Nr_Words;
}
int main()
{
Solve();
fin.close();
fout.close();
return 0;
}