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 1027. D++ Again

A tip for C++ users who got WA!Mind the spaces!
Posted by cloudygooose 4 Jul 2010 08:51
Mind the spaces!
If you use
cin >> s1
The spaces will be ingnored!
I use this to get AC
    while (cin)
    {
        c = '';
        c = cin.get();
        if (c != '\n')    s += c;
    }
hope I can help you.
Re: A tip for C++ users who got WA!Mind the spaces!
Posted by Mehran.R 27 Oct 2010 17:30
hi
write this statement while(getline(cin,s1)){...}
Re: A tip for C++ users who got WA!Mind the spaces!
Posted by Fastholf 22 Nov 2010 09:45
You can also use
  cin >> noskipws;
After this spaces won't be ignored.

Edited by author 22.11.2010 09:46