ll solve(string& s, int k){ int n = s.length(); for(int i = n - 1, kk = k; i >= 0and kk >= 0; i--, kk--) { if(s[i] == '0') continue; swap(s[i], s[n - 1]); k = kk; break; } for(int i = 0, kk = k; i < n - 1and kk >= 0; i++, kk--) { if(s[i] == '0') continue; swap(s[i], s[0]); k = kk; break; }
ll res = 0; for(int i = 0; i < n - 1; i++) { if(s[i] == '1') res += 10; if(s[i + 1] == '1') res += 1; } return res; }