From 4875d6b1c79dfdc291fa7af650a6ca30a17959d5 Mon Sep 17 00:00:00 2001 From: chayan das Date: Tue, 1 Jul 2025 20:42:10 +0530 Subject: [PATCH] Create 3330. Find the Original Typed String I --- 3330. Find the Original Typed String I | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 3330. Find the Original Typed String I diff --git a/3330. Find the Original Typed String I b/3330. Find the Original Typed String I new file mode 100644 index 0000000..28ba92d --- /dev/null +++ b/3330. Find the Original Typed String I @@ -0,0 +1,19 @@ +class Solution { +public: + int possibleStringCount(string word) { + int count = 1; + int result = 0; + + for (int i = 1; i < word.size(); i++) { + if (word[i] == word[i - 1]) { + count++; + } else { + result += (count - 1); + count = 1; + } + } + + result += (count - 1); + return result + 1; + } +};