From ed30499f7213c756c75527673dd9dbcc1bf059b5 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Tue, 1 Nov 2022 13:18:09 +0200 Subject: Added first 3 problem of CSES problem set --- cses/Repetitions/main | Bin 0 -> 23416 bytes cses/Repetitions/main.cpp | 21 +++++++++++++++++++++ cses/Repetitions/main_input0.txt | 1 + cses/Repetitions/main_output0.txt | 1 + 4 files changed, 23 insertions(+) create mode 100755 cses/Repetitions/main create mode 100644 cses/Repetitions/main.cpp create mode 100644 cses/Repetitions/main_input0.txt create mode 100644 cses/Repetitions/main_output0.txt (limited to 'cses/Repetitions') diff --git a/cses/Repetitions/main b/cses/Repetitions/main new file mode 100755 index 0000000..e124ce4 Binary files /dev/null and b/cses/Repetitions/main differ diff --git a/cses/Repetitions/main.cpp b/cses/Repetitions/main.cpp new file mode 100644 index 0000000..cc45f63 --- /dev/null +++ b/cses/Repetitions/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + int mx = 1; + int cnt = 1; + for (int i = 0; i < s.length() - 1; ++i) { + if(s[i] == s[i + 1]) { + cnt++; + mx = max(mx, cnt); + } else { + cnt = 1; + } + } + cout << mx << endl; +} diff --git a/cses/Repetitions/main_input0.txt b/cses/Repetitions/main_input0.txt new file mode 100644 index 0000000..a6c74b2 --- /dev/null +++ b/cses/Repetitions/main_input0.txt @@ -0,0 +1 @@ +ATTCGGGA diff --git a/cses/Repetitions/main_output0.txt b/cses/Repetitions/main_output0.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/cses/Repetitions/main_output0.txt @@ -0,0 +1 @@ +3 -- cgit v1.2.3