aboutsummaryrefslogtreecommitdiff
path: root/01_introductory_problems/repetitions_1069.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--01_introductory_problems/repetitions_1069.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/01_introductory_problems/repetitions_1069.cpp b/01_introductory_problems/repetitions_1069.cpp
new file mode 100644
index 0000000..790f315
--- /dev/null
+++ b/01_introductory_problems/repetitions_1069.cpp
@@ -0,0 +1,20 @@
1#include <algorithm>
2#include <iostream>
3#include <string>
4
5int main() {
6 char cur{'x'};
7 int n{0}, m{0};
8 std::string str;
9 std::cin >> str;
10 for (auto c : str) {
11 if (c == cur) {
12 n++;
13 } else {
14 m = std::max(m, n);
15 n = 1;
16 cur = c;
17 }
18 }
19 std::cout << std::max(m, n) << std::endl;
20}

Generated with cgit - Back to sebastiano.tronto.net