diff --git a/problem/P2708/P2708.cpp b/problem/P2708/P2708.cpp new file mode 100644 index 00000000..1c755b59 --- /dev/null +++ b/problem/P2708/P2708.cpp @@ -0,0 +1,19 @@ +#include + +using namespace std; + +int main() { + string s; + cin >> s; + int ans = s.size() - 1; + for (int i = 1; i < s.size(); i++) { + if (s[i] == s[i - 1]) { + ans--; + } + } + if (s[s.size() - 1] == '0') { + ans++; + } + cout << ans << endl; + return 0; +}