#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = int64_t; using u32 = uint32_t; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; int main() { string s, t = "046889"; cin >> s; int ans1 = static_cast(s.size()*2 + 1), ans2 = static_cast(s.size()+2); for (auto &&i : t) { for (auto &&j : s) { if(i == j) ans1++, ans2 += 2; } } cout << min(ans1, ans2) << "\n"; return 0; }