is a string problem .....
Note that there are few ways to make mistakes,,,,
All my problems are in the past, when I read a new word, I don't know if it was a word or it's over.
And there's a final end to the sentence.
There might be a line break or something.
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
using namespace Std;
int tot;
BOOL Over=true;
BOOL Cap (char c)
{
if (c>= ' A ' &&c<= ' Z ') return true;
else return false;
}
BOOL Letter (char c)
{
if (c>= ' A ' &&c<= ' Z ' | | C>= ' a ' &&c<= ' Z ') return true;
return false;
}
int main ()
{
int i,j,k;
char c;
while ((C=getchar ())!=eof)
{
if (c== '. ' | | c== '! ' | | c== '? ') {over=true; continue;}
if (!letter (c)) continue;
if (Over&&!cap (c)) tot++;
Over=false;
C=getchar ();
while (letter (c))
{
if (Cap (c)) tot++;
C=getchar ();
}
if (c== '. ' | | c== '! ' | | c== '? ') Over=true;
}
printf ("%d\n", tot);
return 0;
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Ural 1038. Spell Checker