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

Show all messages Hide all messages

#include<iostream>
#include<string>
using namespace std;
int main ()
{
    char c;
    int i,sz,l=0,l1=0;
    while(cin.get(c))
{
    if(l1==0&&c>='A'&&c<='Z'){cout<<c;l1=1;continue;}
    if(c==' '||c==','||c=='-'||c=='\n')cout<<c;
    else
    if(c=='.'||c=='?'||c=='!'){cout<<c;l=1;}
    else
    if(l==1){cout<<c;l=0;}
    else
    cout<<char(c-('A'-'a'));
}
    return 0;
}





Whats wrong ??????
u r program's output for these test cases is wrong
1)
--hello
World

2)
"--hELLO"
WORLD
Re: Whats wrong with that C++ program ?!? WA#2 Alexander Sokolov [MAI] 20 Aug 2008 04:04
These test cases are wrong.
Your variable l1 is allways 1 except for the beginning of the input file, you should set it to 0 after the end of the sentence.