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 1601. AntiCAPS

wrong answer #1
Posted by Dejust 26 Feb 2011 21:32
I did some tests. They imply that the program gives correct results, but the system says: "wrong answer".... Why?

screenshot: http://i077.radikal.ru/1102/59/2854393a1c43.jpg

Excuse me for my english
Re: wrong answer #1
Posted by Dejust 27 Feb 2011 15:45
my code:


#include <string>
#include <iostream>
using namespace std;
int main()
{
    string line;

    getline(cin, line);

    static bool sing = false;
    for(int i = 0; i < line.length(); i++)
    {
        if(sing)
        {
            if((line[i] >= 'A') && (line[i] <= 'Z'))
            {
                char temp = line[i] - ('A'-'a');
                cout << temp;
            }
            else if((line[i] == '.') || (line[i] == '!') || (line[i] == '?'))
            {
                cout << line[i];
                sing = false;
            }
            else if(line[i] == 10 || line[i] == 26)
            {
                cout << '\n';
            }
            else
            {
                cout << line[i];
            }
        }
        else
        {
            if(line[i] >= 'A' && line[i] <= 'Z')
            {
                cout << line[i];
                sing = true;
            }
            else if(line[i] == 10 || line[i] == 26)
            {
                cout << '\n';
            }
            else if((line[i] == '.') || (line[i] == '!') || (line[i] == '?'))
            {
                cout << line[i];
            }
            else
            {
                cout << line[i];
            }
        }
    }
    return 0;
}
Re: wrong answer #1
Posted by Arseniy 1 Jul 2013 01:30
Cause your first char is lower? but it should be upper..