import sys
sys.setrecursionlimit(100000)
l=list(input())
m=int(input())
ans=[]
def fun(step,balance,weight):
if step==m:
return 1
if balance>0:
for i in range(len(l)):
if i+1==weight:
continue
if l[i]=="1" and balance-i-1<0:
ans.append(i+1)
if fun(step+1,balance-i-1,i+1):
return 1
ans.pop()
return 0
if balance<0:
for i in range(len(l)):
if i+1==weight:
continue
if (l[i]=="1" and balance+i+1>0):
ans.append(i+1)
if fun(step+1,balance+i+1,i+1):
return 1
ans.pop()
return 0
if balance==0:
for i in range(len(l)):
if l[i]=="1":
ans.append(i+1)
if fun(step+1,i+1,i+1):
return 1
ans.pop()
return 0
if fun(0,0,0):
print("YES")
print(*ans)
else :
print("NO")
#include <bits/stdc++.h>
using namespace std;
#define long long long
#define INF ((long) 1e18)
#define MOD ((long) 1e9 + 7)
#define mll map<long, long>
#define pll pair<long, long>
#define pb push_back
#define FOR(i, a, b) \
for (long i = (a); i < (long) (b); i++)
#define PRINTV(v) \
FOR (_i, 0, v.size()) \
cout << v[_i] << " "; \
cout << "\n";
long f[1010][101][15];
long solve(long m, long x, long ant, string &s, auto &resp)
{
if (m == 0) return 1;
if (f[m][x][ant] != 0) return f[m][x][ant];
FOR (i, 0, s.size()) {
if (s[i] == '0') continue;
long y = i+1;
if (y > x and y != ant) {
if (solve(m-1, y-x, y, s, resp) == 1) {
f[m][x][ant] = 1;
resp.pb(y);
return 1;
}
}
}
f[m][x][ant] = -1;
return -1;
}
int main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
string s;
long m;
cin >> s >> m;
vector<long> resp;
long ok = solve(m, 0, -1, s, resp);
if (ok == -1) puts("NO");
else {
cout << "YES" << endl;
reverse(resp.begin(), resp.end());
PRINTV(resp);
}
}
151C - Win or Freeze | 1585A - Life of a Flower |
1662A - Organizing SWERC | 466C - Number of Ways |
1146A - Love "A" | 1618D - Array and Operations |
1255A - Changing Volume | 1710C - XOR Triangle |
415C - Mashmokh and Numbers | 8A - Train and Peter |
591A - Wizards' Duel | 1703G - Good Key Bad Key |
1705A - Mark the Photographer | 1707A - Doremy's IQ |
1706B - Making Towers | 1325B - CopyCopyCopyCopyCopy |
1649C - Weird Sum | 1324B - Yet Another Palindrome Problem |
525A - Vitaliy and Pie | 879A - Borya's Diagnosis |
1672B - I love AAAB | 1673A - Subtle Substring Subtraction |
1345A - Puzzle Pieces | 711A - Bus to Udayland |
779B - Weird Rounding | 1703D - Double Strings |
1704C - Virus | 63A - Sinking Ship |
1704B - Luke is a Foodie | 298B - Sail |