commit 88bd7c201885fcbf6ce3a1d9ba959294ef85f75f parent 58b9272c56c653898c6080f733b1add6e9263f1e Author: superpozycja <anna@superpozycja.net> Date: Wed, 23 Oct 2024 21:21:31 +0200 solve repetitions Diffstat:
A | intro/repetitions.cpp | | | 28 | ++++++++++++++++++++++++++++ |
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/intro/repetitions.cpp b/intro/repetitions.cpp @@ -0,0 +1,28 @@ +#include <bits/stdc++.h> + +using namespace std; + +void solve() +{ + int res = 1; + string l; + + while (getline(cin, l)) { + int s = 1; + + for (int i = 0; i < l.length()-1; i++) { + if (l[i] == l[i+1]) { + s++; + } else { + s = 1; + } + res = res > s ? res : s; + } + } + cout << res << "\n"; +} + +int main() +{ + solve(); +}