|
|
back to boardWhy WA#4 C++ #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 Re: Why WA#4 C++ Ohhhhh..... I find my wrong... -HI - HI WA: -Hi - Hi AC: -Hi - hi |
|
|