Cod sursa(job #1598580)
| Utilizator | Data | 13 februarie 2016 00:11:27 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
#include <string>
int main(void)
{
std::ifstream in("text.in");
std::ofstream out("text.out");
std::string line;
unsigned int spaces = 1, length;
std::getline(in, line);
length = line.size();
for(unsigned int i = 0; i < line.size(); i++)
{
if(line[i]==' ')
{
spaces++;
length--;
}
else
if(isalpha(line[i])==0)
length--;
}
out<<length/spaces;
}
