Submission #398899

# Submission time Handle Problem Language Result Execution time Memory
398899 2021-05-04T21:59:19 Z Alexandra Imena (COCI16_imena) C++14
0 / 50
1 ms 312 KB
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;
	int resp=0;
	string s;
	int i=0;

	while (cin >> s) {
		bool name = false;

		if (i==n) {
			break;
		}

		if (s[0] >='A' && s[0]<='Z') {
			name = true;
			for (int j=0; j<s.length(); j++) {
				if (s[s.length()-1]>='0' && s[s.length()-1]<='9') {
					name = false;
					break;
				}

				else if ((s[i]>='a' && s[i]<='z') || (s[s.length()-1]=='.' || s[s.length()-1]=='?' || s[s.length()-1]=='!')) {
					continue;
				}
				else {
					name = false;
					break;
				}
			}

			if (name==true) {
				resp++;
			}

		}
		if (s[s.length()-1]=='.' || s[s.length()-1]=='?' || s[s.length()-1]=='!') {
			cout << resp << endl;
			resp = 0;
			i++;
		}
	}
	return 0;
}

Compilation message

imena.cpp: In function 'int main()':
imena.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    for (int j=0; j<s.length(); j++) {
      |                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Incorrect 1 ms 312 KB Output isn't correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Incorrect 1 ms 204 KB Output isn't correct