-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path774.cpp
More file actions
74 lines (70 loc) · 1.62 KB
/
774.cpp
File metadata and controls
74 lines (70 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(int argc, char const *argv[])
{
string s, maxs;
int max = -1;
while (cin >> s)
{
int cnt = 0;
if (s[s.size() - 1] == '.')
cnt = s.size() - 1;
else
cnt = s.size();
if (cnt > max)
{
max = cnt;
maxs = s;
}
// cout << maxs << cnt << endl;
if (s[s.size() - 1] == '.')
break;
}
// cout << maxs << endl;
for (auto i : maxs)
{
if (i != '.')
cout << i;
}
cout << endl;
return 0;
}
/*int main(int argc, char const *argv[])
{
string s, maxs;
int max = -1;
while (cin >> s)
{
int cnt = 0;
bool flag = false;
for (auto i : s)
{
if (i != '.')
cnt++;
else
flag = true;
}
// cout << endl;
if (cnt > max)
{
max = cnt;
maxs = s;
// cout << maxs; // 你这行的输出可以改一下
// 你觉得呢,反正就是把原来一次性输出包含句号的字符串
// 改成判断一下字符串的每一个字符,不是句号才输出
// 这个i可以和‘ .’ 直接比较哇?
}
// cout << "max = " << max << " " << maxs << endl;
if (flag)
break;
}
for (auto i : maxs)
{
if (i != '.')
cout << i;
}
cout << endl;
return 0;
}*/