#include #include #include using namespace std; int main() { string s; cin >> s; int holes[] = {1, 0, 0, 0, 1, 0, 1, 0, 2, 1}; int n_hole = 0; for (auto c : s) { n_hole += holes[c - '0']; } int ans = s.size() * 2 + 1; int n = s.size(); // 字を先 int x = n + n_hole + 1 + n; // 外を先 int y = 1 + n_hole + n + 1 + n_hole; cout << min(x, y) << endl; return 0; }