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

Burdin Artyom`~ Why WA#4 C++ [1] // Problem 1601. AntiCAPS 16 Aug 2018 17:57
#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    int pe = 0;
    while(getline(cin, s)) {
        for (int i = 0; i < s.length(); i++) {
            if (s[i] == '.' || s[i] == '!' || s[i] == '?' || (s[i] == '-' && i )) {
                pe = 0;
            }
            if ((s[i] - '0' + '0' >= 65 && s[i] - '0' + '0' <= 90) && pe != 0) {
                s[i] = s[i] - '0' + 32 + '0';
            }
            if (pe == 0 && s[i] != ' ' && s[i] != '.' && s[i] != '!' && s[i] != '?' && s[i] != '-') {
                if (s[i] - '0' + '0' > 90) {
                    s[i] = s[i] - '0' - 32 + '0';
                }
                pe = 1;
            }
        }
        cout << s << '\n';
    }
}

Edited by author 16.08.2018 18:05

Edited by author 16.08.2018 18:05
Burdin Artyom`~ Re: Why WA#4 C++ // Problem 1601. AntiCAPS 16 Aug 2018 18:07
Ohhhhh..... I find my wrong...

-HI
- HI

WA:

-Hi
- Hi

AC:

-Hi
- hi