ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1038. Spell Checker

admins, my programm outputs correct answers on all the possible test cases but here I get WA2
Posted by arrammis 12 Jun 2015 15:57
What is in test 2 ??????????????????
YOUR TEST CASES ARE WROUNG

MY PROGRAMM IS CORRECT !!

my code:

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[])
{
    string sent;
    char c = 0;
    size_t count = 0;
    while (cin.get(c))
    {
        sent.push_back(c);
        if (c == '.' || c == '?' || c == '!')
        {
            size_t i = 0;
            while (i < sent.size() && !isalpha(sent[i]))
            {
                i++;
            }

            if (i < sent.size() && islower(sent[i]))
                count++;

            string word = "";
            for (size_t i = 0; i < sent.size() + 1; i++)
            {
                if (i < sent.size() && (isalpha(sent[i])))
                {
                    word += sent[i];
                }
                else
                {
                    for (size_t j = 1; j < word.size(); j++)
                    {
                        if (isupper(word[j]) && isalpha(word[j]))
                            count++;
                    }
                    word = "";
                }
            }
            sent.clear();
            //cout << count << endl;
        }
    }
    cout << count;
    return 0;
}


Edited by author 12.06.2015 20:13

Edited by author 12.06.2015 20:13