Ural 1038. Spell Checker

Source: Internet
Author: User



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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.