Pagini recente » Borderou de evaluare (job #1330607) | Cod sursa (job #2375502) | Cod sursa (job #2405696) | Cod sursa (job #2314070) | Cod sursa (job #2773713)
#include <fstream>
using namespace std;
/**********************************/
/// INPUT / OUTPUT
ifstream f("text.in");
ofstream g("text.out");
/**********************************/
/// GLOBAL DECLARATIONS
int ans, wordCount, letterCount;
char ch, prev_ch;
/**********************************/
/// FUNCTIONS
void Solution();
void Output();
/**********************************/
///-----------------------------------------
bool IsInAlphabet(char ch)
{
return ('a' <= ch && ch <= 'z') ||
('A' <= ch && ch <= 'Z');
}
///-----------------------------------------
inline void Solution()
{
f.get(prev_ch);
if (IsInAlphabet(prev_ch))
letterCount += 1;
while (f.get(ch))
{
if (!IsInAlphabet(ch))
{
if (IsInAlphabet(prev_ch))
wordCount ++;
}
else
{
letterCount ++;
}
prev_ch = ch;
}
}
///-----------------------------------------
inline void Output()
{
g << letterCount / wordCount;
}
///-----------------------------------------
int main()
{
Solution();
Output();
return 0;
}