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

WA 11, what can be wrong?
Posted by Mansur 5 May 2009 16:35
Here my code
#include<iostream>
using namespace std;
void main()
{
        char c,str[10000]; int f=0,i=0;
        while (cin.get(c))
        {

                if (c=='!'||c=='?'||c=='.') {f=0; str[i]=c; i++;} else
                if (c>='A'&&c<='Z')
                {
                if (f!=0) {str[i]=c-'A'+'a'; i++;} else {str[i]=c; i++; f++;}
                } else {str[i]=c; i++;}
        }
        cout<<str;

}
Re: WA 11, what can be wrong?
Posted by XMAN 12 Nov 2009 08:10
Hello;
Pay attention: "Total length of message is not exceeding 10000 symbols."
try with an input containing 10000 symbols.
for eg: if the input contain 10000 H (HH.........HHH )
your programm output:
Hhhh...........hhh­®Àw$üÓÓ¶€|¨ÿ"HÐ)>

the problem is in the function "cout"
So don't stock c in str; just print it.
i hope that's help you.