Submission #703976

#TimeUsernameProblemLanguageResultExecution timeMemory
703976vjudge1Imena (COCI16_imena)C++11
50 / 50
1 ms300 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; getchar(); string s; getline(cin, s); s += ' '; int ans = 0, flag = 0, down = 0, b = 1; for (int j = 0; j < s.size(); ++j) { char ss = s[j]; if (ss == ' '){ if (flag == 1) ans++, flag = 0; if (s[j-1] == '.' || s[j-1] == '?' || s[j-1] == '!') { cout << ans << endl; ans = 0, flag = 0; } } else if (ss >= 'A' && ss <= 'Z') flag = 1; else if (!((ss >= 'A' && ss <= 'Z') || (ss >= 'a' && ss <= 'z')) && ss != '.' && ss != '!' && ss != '?' ) flag = 0; } }

Compilation message (stderr)

imena.cpp: In function 'int main()':
imena.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int j = 0; j < s.size(); ++j) {
      |                  ~~^~~~~~~~~~
imena.cpp:13:25: warning: unused variable 'down' [-Wunused-variable]
   13 |  int ans = 0, flag = 0, down = 0, b = 1;
      |                         ^~~~
imena.cpp:13:35: warning: unused variable 'b' [-Wunused-variable]
   13 |  int ans = 0, flag = 0, down = 0, b = 1;
      |                                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...