#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int turn, weight, vzyal, delat;
};

node p[1000][11][11][2];
int m;
string s;
vector <int> ger;

void ans(node v)
{
  vector <int> path;
  while(v.turn != 0 || v.weight != 0 || v.vzyal != 0 || v.delat != 2){
    path.pb(v.vzyal);
    v = p[v.turn][v.weight][v.vzyal][v.delat];
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  exit(0);
}

void dfs(node v)
{
  if(v.turn == m){
    ans(v);
    return;
  }
  for(int i : ger){
    if(v.delat == 2 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
      p[v.turn + 1][abs(v.weight - i)][i][1] = v;
      //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 1 << endl;
      dfs({v.turn + 1, abs(v.weight - i), i, 1});
    }if(v.delat == 1 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
      p[v.turn + 1][abs(v.weight - i)][i][2] = v;
      //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 2 << endl;
      dfs({v.turn + 1, abs(v.weight - i), i, 2});
    }
  }
}

int main()
{
  Need_for_speed();
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  dfs({0, 0, 0, 2});
  cout << "NO";
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int g, h, f;
};

llong m;
string s;
vector <int> ger;
vector <node> g[1001][11][11], path;
bool ok;
node start, p[1001][11][11];

void dfs(node v)
{
  //cout << v.g << ' ' << v.h << ' ' << v.f << endl;
  if(v.g == m){
    ok = 1;
    start = v;
  }
  for(node i : g[v.g][v.h][v.f]){
    p[i.g][i.h][i.f].g = v.g;
    p[i.g][i.h][i.f].h = v.h;
    p[i.g][i.h][i.f].f = v.f;
    dfs({i.g, i.h, i.f});
  }
}

int main()
{
  queue <node> q;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  q.push({0, 0, 0});
  //was[0][0][0] = 1;
  while(!q.empty()){
    node v;
    v = q.front();
    q.pop();
    if(v.g % 2 == 0){
      for(int i : ger){
        if(v.h != i && v.f + i > v.f && v.f + i <= 10 && v.f + i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f + i});
          q.push({v.g + 1, i, v.f + i});
          //was[v.g + 1][i][v.f + i] = 1;
        }
      }
    }
    if(v.g % 2 != 0){
      for(int i : ger){
        if(v.h != i && v.f - i < v.f && v.f - i >= -10 && v.f - i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f - i});
          q.push({v.g + 1, i, v.f - i});
          //was[v.g + 1][i][v.f - i] = 1;
        }
      }
    }
  }
  dfs({0, 0, 0});
  if(!ok){
    cout << "NO";
    return 0;
  }
  while(start.g != 0 || start.h != 0 || start.f != 0){
    path.pb({start.g, start.h, start.f});
    node now = start;
    start.g = p[now.g][now.h][now.f].g;
    start.h = p[now.g][now.h][now.f].h;
    start.f = p[now.g][now.h][now.f].f;
  }
  cout << "YES" << endl;
  for(node i : path){
    cout << i.h << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

int m, ans[10001], sum_1, sum_2;
string s;

int main()
{
  vector <int> v;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') v.pb(i + 1);
  }
  cin >> m;
  if(v.size() >= 2){
    ans[1] = v[v.size() - 2], sum_1 += v[v.size() - 2];
  }else{
    ans[1] = v[v.size() - 1], sum_1 += v[v.size() - 1];
  }
  for(int i = 2; i <= m; i++){
    if(i % 2 == 0){
      for(int j : v){
        if(j != ans[i - 1] && sum_2 + j > sum_1){
          sum_2 += j;
          ans[i] = j;
          break;
        }
      }
    }else if(i % 2 != 0){
      for(int j : v){
        if(j != ans[i - 1] && sum_1 + j > sum_2){
          sum_1 += j;
          ans[i] = j;
          break;
        }
      }
    }
    if(!ans[i]){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int g, h, f;
};

llong m;
string s;
vector <int> ger, path;
vector <node> g[1001][11][11];
bool ok, used[1001][11][11];
node start, p[1001][11][11];

void dfs(node v)
{
  used[v.g][v.h][v.f] = 1;
  if(v.g == m){
    ok = 1;
    start = v;
  }
  for(node i : g[v.g][v.h][v.f]){
    if(!used[i.g][i.h][i.f]){
      p[i.g][i.h][i.f].g = v.g;
      p[i.g][i.h][i.f].h = v.h;
      p[i.g][i.h][i.f].f = v.f;
      dfs({i.g, i.h, i.f});
    }
  }
}

int main()
{
  Need_for_speed();
  queue <node> q;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  q.push({0, 0, 0});
  //was[0][0][0] = 1;
  while(!q.empty()){
    node v;
    v = q.front();
    q.pop();
    if(v.g % 2 == 0){
      for(int i : ger){
        if(v.h != i && v.f + i > v.f && v.f + i <= 10 && v.f + i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f + i});
          q.push({v.g + 1, i, v.f + i});
          //was[v.g + 1][i][v.f + i] = 1;
        }
      }
    }
    if(v.g % 2 != 0){
      for(int i : ger){
        if(v.h != i && v.f - i < v.f && v.f - i >= -10 && v.f - i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f - i});
          q.push({v.g + 1, i, v.f - i});
          //was[v.g + 1][i][v.f - i] = 1;
        }
      }
    }
  }
  dfs({0, 0, 0});
  if(!ok){
    cout << "NO";
    return 0;
  }
  while(start.g != 0 || start.h != 0 || start.f != 0){
    path.pb(start.h);
    node now = start;
    start.g = p[now.g][now.h][now.f].g;
    start.h = p[now.g][now.h][now.f].h;
    start.f = p[now.g][now.h][now.f].f;
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

int m, ans[10001], sum_1, sum_2;
string s;

int main()
{
  vector <int> v;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') v.pb(i + 1);
  }
  cin >> m;
  ans[1] = v[v.size() - 2], sum_1 += v[v.size() - 2];
  for(int i = 2; i <= m; i++){
    if(i % 2 == 0){
      for(int j : v){
        if(j != ans[i - 1] && sum_2 + j > sum_1){
          sum_2 += j;
          ans[i] = j;
          break;
        }
      }
    }else if(i % 2 != 0){
      for(int j : v){
        if(j != ans[i - 1] && sum_1 + j > sum_2){
          sum_1 += j;
          ans[i] = j;
          break;
        }
      }
    }
    if(!ans[i]){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int turn, weight, vzyal, delat;
};

node p[1000][11][11][2];
int m;
string s;
vector <int> ger;

void ans(node v)
{
  vector <int> path;
  while(v.turn != 0 || v.weight != 0 || v.vzyal != 0 || v.delat != 2){
    path.pb(v.vzyal);
    v = p[v.turn][v.weight][v.vzyal][v.delat];
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  exit(0);
}

void dfs(node v)
{
  if(v.turn == m){
    ans(v);
  }
  for(int i : ger){
    if(v.delat == 2 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
      p[v.turn + 1][abs(v.weight - i)][i][1] = v;
      //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 1 << endl;
      dfs({v.turn + 1, abs(v.weight - i), i, 1});
    }if(v.delat == 1 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
      p[v.turn + 1][abs(v.weight - i)][i][2] = v;
      //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 2 << endl;
      dfs({v.turn + 1, abs(v.weight - i), i, 2});
    }
  }
}

int main()
{
  Need_for_speed();
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  dfs({0, 0, 0, 2});
  cout << "NO";
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

int m, ans[10001], sum_1, sum_2;
string s;
vector <int> v;
bool flag, ok;

void comp()
{
  ok = true;
  for(int i = 2; i <= m; i++){
    if(i % 2 == 0){
      for(int j : v){
        if(ans[i - 1] != j && sum_2 + j > sum_1){
          sum_2 += j;
          ans[i] = j;
          break;
        }
      }
    }
    if(i % 2 != 0){
      for(int j : v){
        if(ans[i - 1] != j && sum_1 + j > sum_2){
          sum_1 += j;
          ans[i] = j;
          break;
        }
      }
    }
    if(!ans[i]){
      ok = false;
      break;
    }
  }
  for(int i = 2; i <= m; i++){
    if(ans[i] == ans[i - 1]){
      ok = false;
      break;
    }
  }
}

int main()
{
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') v.pb(i + 1);
  }
  cin >> m;
  if(v.empty()){
    cout << "NO";
    return 0;
  }
  for(int i = 0; i < v.size(); i++){
    sum_1 = 0, sum_2 = 0;
    ans[1] = v[i];
    sum_1 += v[i];
    comp();
    if(ok){
      break;
    }
  }
  if(!ok){
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

string s;
llong m, sum_1, sum_2, ans[MXN], sum[MXN];
bool dp[MXN];
vector <int> v, num[MXN];

int main()
{
  cin >> s >> m;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1'){
      v.pb(i + 1);
    }
  }
  if(v.empty()){
    cout << "NO";
    return 0;
  }
  dp[0] = true;
  for(int i : v){
    for(int j = 0; j <= 10000; j++){
      if(dp[j]){
        num[j + i].pb(i);
        dp[j + i] = true;
      }
    }
  }
  for(int i = 1; i <= m; i++){
    bool ok = false;
    if(i % 2 != 0){
      for(int j = sum_1; j <= 10010; j++){
        if(dp[j] && j > sum_2){
          for(int k : num[j]){
            if(k != ans[i - 1] && k + sum_1 == j){
              sum_1 += k;
              ans[i] = k;
              ok = true;
              break;
            }
          }
          if(ok){
            break;
          }
        }
      }
    }else if(i % 2 == 0){
      for(int j = sum_2; j <= 10010; j++){
        if(dp[j] && j > sum_1){
          for(int k : num[j]){
            if(k != ans[i - 1] && k + sum_2 == j){
              sum_2 += k;
              ans[i] = k;
              ok = true;
              break;
            }
          }
          if(ok){
            break;
          }
        }
      }
    }
    if(!ok){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int turn, weight, vzyal, delat;
};

node p[1001][11][11][2];
int m;
string s;
vector <int> ger;

void ans(node v)
{
  vector <int> path;
  while(v.turn != 0 || v.weight != 0 || v.vzyal != 0 || v.delat != 2){
    path.pb(v.vzyal);
    v = p[v.turn][v.weight][v.vzyal][v.delat];
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  exit(0);
}

void dfs(node v)
{
  if(v.turn == m){
    ans(v);
    return;
  }
  for(int i : ger){
    if(v.turn + 1 <= m){
      if(v.delat == 2 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
        p[v.turn + 1][abs(v.weight - i)][i][1] = v;
        //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 1 << endl;
        dfs({v.turn + 1, abs(v.weight - i), i, 1});
      }if(v.delat == 1 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
        p[v.turn + 1][abs(v.weight - i)][i][2] = v;
        //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 2 << endl;
        dfs({v.turn + 1, abs(v.weight - i), i, 2});
      }
    }
  }
}

int main()
{
  Need_for_speed();
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  dfs({0, 0, 0, 2});
  cout << "NO";
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int turn, weight, vzyal, delat;
};

node p[1000][11][11][2];
int m;
string s;
vector <int> ger;

void ans(node v)
{
  vector <int> path;
  while(v.turn != 0 || v.weight != 0 || v.vzyal != 0 || v.delat != 2){
    path.pb(v.vzyal);
    v = p[v.turn][v.weight][v.vzyal][v.delat];
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  exit(0);
}

void dfs(node v)
{
  if(v.turn == m){
    ans(v);
  }
  for(int i : ger){
    if(v.delat == 2 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal){
      p[v.turn + 1][abs(v.weight - i)][i][1] = v;
      //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 1 << endl;
      dfs({v.turn + 1, abs(v.weight - i), i, 1});
    }if(v.delat == 1 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal){
      p[v.turn + 1][abs(v.weight - i)][i][2] = v;
      //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 2 << endl;
      dfs({v.turn + 1, abs(v.weight - i), i, 2});
    }
  }
}

int main()
{
  Need_for_speed();
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  dfs({0, 0, 0, 2});
  cout << "NO";
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int turn, weight, vzyal, delat;
};

node p[1001][11][11][2];
int m;
string s;
vector <int> ger;

void ans(node v)
{
  vector <int> path;
  while(v.turn != 0 || v.weight != 0 || v.vzyal != 0 || v.delat != 2){
    path.pb(v.vzyal);
    v = p[v.turn][v.weight][v.vzyal][v.delat];
  }
  reverse(all(path));
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  exit(0);
}

void dfs(node v)
{
  if(v.turn == m){
    ans(v);
    return;
  }
  for(int i : ger){
    if(v.turn + 1 <= m){
      if(v.delat == 2 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
        p[v.turn + 1][abs(v.weight - i)][i][1] = v;
        //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 1 << endl;
        dfs({v.turn + 1, abs(v.weight - i), i, 1});
      }if(v.delat == 1 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
        p[v.turn + 1][abs(v.weight - i)][i][2] = v;
        //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 2 << endl;
        dfs({v.turn + 1, abs(v.weight - i), i, 2});
      }
    }
  }
}

int main()
{
  Need_for_speed();
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  dfs({0, 0, 0, 2});
  cout << "NO";
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int g, h, f;
};

llong m;
string s;
vector <int> ger;
vector <node> g[1001][11][11], path;
bool was[1001][11][11], used[1001][11][11], ok;
node start, p[1001][11][11];

void dfs(node v)
{
  //cout << v.g << ' ' << v.h << ' ' << v.f << endl;
  if(v.g == m){
    ok = 1;
    start = v;
  }
  for(node i : g[v.g][v.h][v.f]){
    p[i.g][i.h][i.f].g = v.g;
    p[i.g][i.h][i.f].h = v.h;
    p[i.g][i.h][i.f].f = v.f;
    dfs({i.g, i.h, i.f});
  }
}

int main()
{
  queue <node> q;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  q.push({0, 0, 0});
  was[0][0][0] = 1;
  while(!q.empty()){
    node v;
    v = q.front();
    q.pop();
    if(v.g % 2 == 0){
      for(int i : ger){
        if(v.h != i && v.f + i > v.f && v.f + i <= 10 && !was[v.g + 1][i][v.f + i] && v.f + i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f + i});
          q.push({v.g + 1, i, v.f + i});
          was[v.g + 1][i][v.f + i] = 1;
        }
      }
    }
    if(v.g % 2 != 0){
      for(int i : ger){
        if(v.h != i && v.f - i < v.f && v.f - i >= -10 && !was[v.g + 1][i][v.f - i] && v.f - i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f - i});
          q.push({v.g + 1, i, v.f - i});
          was[v.g + 1][i][v.f - i] = 1;
        }
      }
    }
  }
  dfs({0, 0, 0});
  if(!ok){
    cout << "NO";
    return 0;
  }
  while(start.g != 0 || start.h != 0 || start.f != 0){
    path.pb({start.g, start.h, start.f});
    node now = start;
    start.g = p[now.g][now.h][now.f].g;
    start.h = p[now.g][now.h][now.f].h;
    start.f = p[now.g][now.h][now.f].f;
  }
  cout << "YES" << endl;
  for(node i : path){
    cout << i.h << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int turn, weight, vzyal, delat;
};

node p[1000][11][11][2];
int m;
string s;
vector <int> ger;

void ans(node v)
{
  vector <int> path;
  while(v.turn != 0 || v.weight != 0 || v.vzyal != 0 || v.delat != 2){
    path.pb(v.vzyal);
    v = p[v.turn][v.weight][v.vzyal][v.delat];
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  exit(0);
}

void dfs(node v)
{
  if(v.turn == m){
    ans(v);
    return;
  }
  for(int i : ger){
    if(v.turn + 1 <= m){
      if(v.delat == 2 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
        p[v.turn + 1][abs(v.weight - i)][i][1] = v;
        //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 1 << endl;
        dfs({v.turn + 1, abs(v.weight - i), i, 1});
      }if(v.delat == 1 && abs(v.weight - i) != 0 && i > v.weight && i != v.vzyal && abs(v.weight - i) <= 10){
        p[v.turn + 1][abs(v.weight - i)][i][2] = v;
        //cout << v.turn + 1 << ' ' << abs(v.weight - i) << ' ' << i << ' ' << 2 << endl;
        dfs({v.turn + 1, abs(v.weight - i), i, 2});
      }
    }
  }
}

int main()
{
  Need_for_speed();
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  dfs({0, 0, 0, 2});
  cout << "NO";
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int g, h, f;
};

llong m;
string s;
vector <int> ger, path;
vector <node> g[1001][11][11];
bool ok, used[1001][11][11];
node start, p[1001][11][11];

void dfs(node v)
{
  used[v.g][v.h][v.f] = 1;
  if(v.g == m){
    ok = 1;
    start = v;
  }
  for(node i : g[v.g][v.h][v.f]){
    if(!used[i.g][i.h][i.f]){
      p[i.g][i.h][i.f].g = v.g;
      p[i.g][i.h][i.f].h = v.h;
      p[i.g][i.h][i.f].f = v.f;
      dfs({i.g, i.h, i.f});
    }
  }
}

int main()
{
  Need_for_speed();
  queue <node> q;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  q.push({0, 0, 0});
  while(!q.empty()){
    node v;
    v = q.front();
    q.pop();
    if(v.g % 2 == 0 && v.g + 1 <= m){
      for(int i : ger){
        if(v.h != i && v.f + i > v.f && v.f + i <= 10 && v.f + i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f + i});
          q.push({v.g + 1, i, v.f + i});
          //was[v.g + 1][i][v.f + i] = 1;
        }
      }
    }
    if(v.g % 2 != 0 && v.g + 1 <= m){
      for(int i : ger){
        if(v.h != i && v.f - i < v.f && v.f - i >= -10 && v.f - i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f - i});
          q.push({v.g + 1, i, v.f - i});
          //was[v.g + 1][i][v.f - i] = 1;
        }
      }
    }
  }
  dfs({0, 0, 0});
  if(!ok){
    cout << "NO";
    return 0;
  }
  for(int i = 1; i <= m; i++){
    if(start.g == 0 && start.h == 0 && start.f == 0){
      break;
    }
    path.pb(start.h);
    node now = start;
    start.g = p[now.g][now.h][now.f].g;
    start.h = p[now.g][now.h][now.f].h;
    start.f = p[now.g][now.h][now.f].f;
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int g, h, f;
};

llong m;
string s;
vector <int> ger, path;
vector <node> g[1001][11][11];
bool ok;
node start, p[1001][11][11];

void dfs(node v)
{
  //cout << v.g << ' ' << v.h << ' ' << v.f << endl;
  if(v.g == m){
    ok = 1;
    start = v;
  }
  for(node i : g[v.g][v.h][v.f]){
    p[i.g][i.h][i.f].g = v.g;
    p[i.g][i.h][i.f].h = v.h;
    p[i.g][i.h][i.f].f = v.f;
    dfs({i.g, i.h, i.f});
  }
}

int main()
{
  Need_for_speed();
  queue <node> q;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  q.push({0, 0, 0});
  //was[0][0][0] = 1;
  while(!q.empty()){
    node v;
    v = q.front();
    q.pop();
    if(v.g % 2 == 0){
      for(int i : ger){
        if(v.h != i && v.f + i > v.f && v.f + i <= 10 && v.f + i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f + i});
          q.push({v.g + 1, i, v.f + i});
          //was[v.g + 1][i][v.f + i] = 1;
        }
      }
    }
    if(v.g % 2 != 0){
      for(int i : ger){
        if(v.h != i && v.f - i < v.f && v.f - i >= -10 && v.f - i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f - i});
          q.push({v.g + 1, i, v.f - i});
          //was[v.g + 1][i][v.f - i] = 1;
        }
      }
    }
  }
  dfs({0, 0, 0});
  if(!ok){
    cout << "NO";
    return 0;
  }
  while(start.g != 0 || start.h != 0 || start.f != 0){
    path.pb(start.h);
    node now = start;
    start.g = p[now.g][now.h][now.f].g;
    start.h = p[now.g][now.h][now.f].h;
    start.f = p[now.g][now.h][now.f].f;
  }
  cout << "YES" << endl;
  for(int i : path){
    cout << i << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define b(i,a,b) for(int i=a;i>b;i--)
#define mpr(a,b) make_pair(a,b)
#define prll pair<ll,ll>
#define pri pair<int,int>
#define ll long long
#define inf INT_MAX/10
#define gmax 105
#define mod 100000000
#define line cout<<"\n"
#define bp __builtin_popcount
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define getfile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","r",stdin)
#define givefile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","w",stdout)
main()
{
    string s;
    cin>>s;
    int k;cin>>k;int d=0,a=0,b=0;int j=0;
    vector<int> v;
    do
    {
        //cout<<a<<" "<<b<<endl;
        if(j%2==0)
        {
            f(i,d,10)
            if(s[i]=='1')
            {
                a+=i+1;
                v.pb(i+1);
                d=a-b;
                break;
            }
        }
        else
        {
            f(i,d,10)
            if(s[i]=='1')
            {
                b+=i+1;
                v.pb(i+1);
                d=b-a;
                break;
            }
        }
        j++;
        //d=max(a,b)-min(a,b);

    }while(d>0&&j<k);
    /*cout<<v.size()<<endl;
    f(i,0,v.size())
    cout<<v[i]<<" ";line;*/
    if(v.size()==k)
    {
        cout<<"YES"<<endl;
        f(i,0,v.size())
        cout<<v[i]<<" ";
    }
    else
        cout<<"NO";
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define b(i,a,b) for(int i=a;i>b;i--)
#define mpr(a,b) make_pair(a,b)
#define prll pair<ll,ll>
#define pri pair<int,int>
#define ll long long
#define inf INT_MAX/10
#define gmax 105
#define mod 100000000
#define line cout<<"\n"
#define bp __builtin_popcount
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define getfile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","r",stdin)
#define givefile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","w",stdout)
int main()
{
    string s;
    cin>>s;
    int k;cin>>k;
    vector<int> v;
    f(z,0,10){
        v.clear();
        int d=z,a=0,b=0;int j=0,prev=-1;
    do
    {

        //cout<<a<<" "<<b<<" "<<prev<<" "<<d<<endl;
        if(j%2==0)
        {
            f(i,d,10)
            if(s[i]=='1'&&prev!=i)
            {
                a+=i+1;
                v.pb(i+1);
                d=a-b;
                prev=i;
                break;
            }
        }
        else
        {
            f(i,d,10)
            if(s[i]=='1'&&prev!=i)
            {
                b+=i+1;
                v.pb(i+1);
                d=b-a;
                prev=i;
                break;
            }
        }
        j++;
        //d=max(a,b)-min(a,b);

    }while(d>0&&j<k);
    /*cout<<v.size()<<endl;
    f(i,0,v.size())
    cout<<v[i]<<" ";line;*/
    if(v.size()==k)
    {
        cout<<"YES"<<endl;
        f(i,0,v.size())
        cout<<v[i]<<" ";
        return 0;
    }
    }
        cout<<"NO";
        return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define b(i,a,b) for(int i=a;i>b;i--)
#define mpr(a,b) make_pair(a,b)
#define prll pair<ll,ll>
#define pri pair<int,int>
#define ll long long
#define inf INT_MAX/10
#define gmax 105
#define mod 100000000
#define line cout<<"\n"
#define bp __builtin_popcount
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define getfile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","r",stdin)
#define givefile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","w",stdout)
bool vis[1005][12][12];vector<int> sol,a;string s;int k;int solfound=0;
void dfs(int path,int diff,int prev)
{
    //cout<<path<<" "<<diff<<" "<<prev<<endl;
    if(path>k)
        return ;

    vis[path][diff][prev]=1;
    if(path==k&&solfound==0)
    {
        cout<<"YES"<<endl;
        //cout<<sol.size()<<endl;
        f(i,0,k)
        cout<<sol[i]<<" ";
        solfound=1;
        //return 1;
    }

    f(i,1,11)
    {
        if(i-diff>0&&s[i-1]=='1'&&i!=prev)
        {
            if(vis[path+1][i-diff][i]==0)
            {
                sol.pb(i);
                dfs(path+1,i-diff,i);
                sol.pop_back();
            }
        }
    }
    //return vis[path][diff][prev];
}

int main()
{
    memset(vis,0,sizeof(vis));
    cin>>s;
    cin>>k;dfs(0,0,0);
    if(!solfound)
        cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define b(i,a,b) for(int i=a;i>b;i--)
#define mpr(a,b) make_pair(a,b)
#define prll pair<ll,ll>
#define pri pair<int,int>
#define ll long long
#define inf INT_MAX/10
#define gmax 105
#define mod 100000000
#define line cout<<"\n"
#define bp __builtin_popcount
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define getfile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","r",stdin)
#define givefile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","w",stdout)
bool vis[1005][12][12];vector<int> sol,a;string s;int k;int solfound=0;
void dfs(int path,int diff,int prev)
{
    //cout<<path<<" "<<diff<<" "<<prev<<endl;
    if(path>k)
        return 0;

    vis[path][diff][prev]=1;
    if(path==k&&solfound==0)
    {
        cout<<"YES"<<endl;
        //cout<<sol.size()<<endl;
        f(i,0,k)
        cout<<sol[i]<<" ";
        solfound=1;
        //return 1;
    }

    f(i,1,11)
    {
        if(i-diff>0&&s[i-1]=='1'&&i!=prev)
        {
            if(vis[path+1][i-diff][i]==0)
            {
                sol.pb(i);
                dfs(path+1,i-diff,i);
                sol.pop_back();
            }
        }
    }
    //return vis[path][diff][prev];
}

int main()
{
    memset(vis,0,sizeof(vis));
    cin>>s;
    cin>>k;dfs(0,0,0);
    if(!solfound)
        cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define b(i,a,b) for(int i=a;i>b;i--)
#define mpr(a,b) make_pair(a,b)
#define prll pair<ll,ll>
#define pri pair<int,int>
#define ll long long
#define inf INT_MAX/10
#define gmax 105
#define mod 100000000
#define line cout<<"\n"
#define bp __builtin_popcount
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define getfile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","r",stdin)
#define givefile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","w",stdout)
bool vis[1005][12][12];vector<int> sol,a;string s;int k;int solfound=0;
void dfs(int path,int diff,int prev)
{
    //cout<<path<<" "<<diff<<" "<<prev<<endl;

    vis[path][diff][prev]=1;
    if(path==k&&solfound==0)
    {
        cout<<"YES"<<endl;
        //cout<<sol.size()<<endl;
        f(i,0,k)
        cout<<sol[i]<<" ";
        solfound=1;
        //return 1;
    }

    f(i,1,11)
    {
        if(vis[path+1][i-diff][i]==0)
        if(i-diff>0&&s[i-1]=='1'&&i!=prev)
        {
            sol.pb(i);
            dfs(path+1,i-diff,i);
            sol.pop_back();
        }
    }
    //return vis[path][diff][prev];
}

int main()
{
    memset(vis,0,sizeof(vis));
    cin>>s;
    cin>>k;dfs(0,0,0);
    if(!solfound)
        cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define b(i,a,b) for(int i=a;i>b;i--)
#define mpr(a,b) make_pair(a,b)
#define prll pair<ll,ll>
#define pri pair<int,int>
#define ll long long
#define inf INT_MAX/10
#define gmax 105
#define mod 100000000
#define line cout<<"\n"
#define bp __builtin_popcount
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define getfile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","r",stdin)
#define givefile freopen("C:\\Users\\VISHAL ASHANK\\Desktop\\inp.txt","w",stdout)
main()
{
    string s;
    cin>>s;
    int k;cin>>k;int d=0,a=0,b=0;int j=0,prev=-1;
    vector<int> v;
    do
    {
        //cout<<a<<" "<<b<<" "<<prev<<" "<<d<<endl;
        if(j%2==0)
        {
            f(i,d,10)
            if(s[i]=='1'&&prev!=i)
            {
                a+=i+1;
                v.pb(i+1);
                d=a-b;
                prev=i;
                break;
            }
        }
        else
        {
            f(i,d,10)
            if(s[i]=='1'&&prev!=i)
            {
                b+=i+1;
                v.pb(i+1);
                d=b-a;
                prev=i;
                break;
            }
        }
        j++;
        //d=max(a,b)-min(a,b);

    }while(d>0&&j<k);
    /*cout<<v.size()<<endl;
    f(i,0,v.size())
    cout<<v[i]<<" ";line;*/
    if(v.size()==k)
    {
        cout<<"YES"<<endl;
        f(i,0,v.size())
        cout<<v[i]<<" ";
    }
    else
        cout<<"NO";
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <string>
#include <limits>
#include <string.h>
#include <math.h>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;

int main(){
  string s = "";
  cin>>s;
  vector<int> v;
  vector<int>::iterator it;
  int pos = 0, ptr = 0;
  for(int i = 0; i < s.size(); ++i){
    if(s[i] == 'l'){
      ptr = i + 1;
      v.insert(v.begin() + pos, ptr);
    }
    else{
      ptr = i + 1;
      v.insert(v.begin() + pos, ptr);
      pos++;
    }
  }
  for(int i = 0; i < v.size(); ++i){
    cout<<v[i]<<endl;
  }

  return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stdio.h>
#include <vector>
#include <deque>

using namespace std;

int n, i, j;
double k = 1.0, o = 0.0, m;
string s;

struct tort {
	int nomber;
	double place;
} answer[10000005];

bool cmp(tort a, tort b){
	if(a.place < b.place){
		return true;
	}
	return false;
}

int main() {
  cin >> s;
  n = s.length();
  answer[0].nomber = 1;
  answer[0].place = (k + o) / 2;
  m = (k + o) / 2;
  for(i = 0; i < n - 1; ++i){
	  if(s[i] == 'l'){
		  k = m;
		  answer[i + 1].nomber = i + 2;
		  answer[i + 1].place = (k + o) / 2;
		  m = (k + o) / 2;
	  }
	  else{
		  o = m;
		  answer[i + 1].nomber = i + 2;
		  answer[i + 1].place = (k + o) / 2;
		  m = (k + o) / 2;
	  }
  }
  sort(answer, answer + n, cmp);
  for(i = 0; i < n; ++i){
	  cout << answer[i].nomber << endl;
  }
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stdio.h>
#include <vector>
#include <deque>

using namespace std;

int n, i, j, k;
deque <int> answer;
string s;

int main() {
  cin >> s;
  n = s.length();
  answer.push_back(n);
  for(i = n - 2; i >= 0; --i){
	  if(s[i] == 'l'){
		  answer.push_back(i + 1);
	  }
	  else{
		  answer.push_front(i + 1);
	  }
  }
  for(i = 0; i < n; ++i){
	  cout << answer.front() << endl;
	  answer.pop_front();
  }
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stdio.h>
#include <vector>
#include <deque>

using namespace std;

int n, i, j;
double k = 1.0, o = 0.0, m;
string s;

struct tort {
	int nomber;
	double place;
} answer[10000005];

bool cmp(tort a, tort b){
	if(a.place < b.place){
		return true;
	}
	return false;
}

int main() {
  cin >> s;
  n = s.length();
  m = (k + o) / 2;
  for(i = 0; i < n; ++i){
	  answer[i].place = m;
	  answer[i].nomber = i + 1;
	  if(s[i] == 'l'){
		  k = m;
	  }
	  else{
		  o = m;
	  }
	  m = (k + o) / 2;
  }
  sort(answer, answer + n, cmp);
  for(i = 0; i < n; ++i){
	  cout << answer[i].nomber << endl;
  }
}


#include <iostream>
#include <cstring>
#include <stack>

using namespace std;

stack < int > st;

int main(){
	string s;
	cin >> s;

	for ( int i = 1; i <= (int)s.length(); i++ )
		if ( s[i - 1] == 'r' )
			cout << i << endl;
		else
			st.push(i);

	while ( st.size() > 0 ){
		cout << st.top() << endl;
		st.pop();
	}

	return 0;
}


#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <climits>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <list>
#include <unordered_set>
#include <unordered_map>
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define sz size()
#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)
#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define ford(i, n) for(int i=(n)-1; i>=0; i--)
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define in(x) int (x); input((x));
#define x first
#define y second
#define less(a,b) ((a) < (b) - EPS)
#define more(a,b) ((a) > (b) + EPS)
#define eq(a,b) (fabs((a) - (b)) < EPS)
#define remax(a, b) ((a) = (b) > (a) ? (b) : (a))
#define remin(a, b) ((a) = (b) < (a) ? (b) : (a))
using namespace std;  typedef long double ld;  template <class _T> inline _T sqr(const _T& x) { return x * x; }  template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }  const ld PI = 3.1415926535897932384626433832795L;  const ld EPS = 1e-8;  char TEMPORARY_CHAR;  typedef long long ll;  typedef unsigned long long ull;  typedef set < int > SI;  typedef vector < int > VI;  typedef vector < vector < int > > VVI;  typedef map < string, int > MSI;  typedef pair < int, int > PII;  const int INF = 2e9;    typedef complex<double> cbase;  inline void fft (vector<cbase> &a, bool invert) {  int n = (int)a.size();  for (int i = 1, j = 0; i < n; ++i)  {  int bit = n >> 1;  for (; j >= bit; bit >>= 1)  j -= bit;  j += bit;  if (i < j)  swap(a[i], a[j]);  }  for (int len = 2; len <= n; len <<= 1)  {  double ang = 2 * (double)PI / len * (invert ? -1 : 1);  cbase wlen(cos(ang), sin(ang));  for (int i = 0; i < n; i += len)  {  cbase w(1);  for (int j=0; j < len / 2; ++j)  {  cbase u = a[i + j], v = a[i + j + len / 2] * w;  a[i + j] = u + v;  a[i + j + len / 2] = u - v;  w *= wlen;  }  }  }  if (invert)  for (int i = 0; i < n; ++i)  a[i] /= n;  }    inline void input(int &a)  {  a = 0;  while (((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') && (TEMPORARY_CHAR != '-')){}  char neg = 0;  if (TEMPORARY_CHAR == '-')  {  neg = 1;  TEMPORARY_CHAR = getchar();  }  while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0')  {  a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0';  TEMPORARY_CHAR = getchar();  }  if (neg)  a = -a;  }  inline void out(int a)  {  if (!a) putchar('0');  if (a < 0)  {  putchar('-');  a = -a;  }  char s[10];  int i;  for(i = 0; a; ++i)  {  s[i] = '0' + a % 10;  a /= 10;  }  ford(j, i) putchar(s[j]);  }  inline int nxt()  {  in(ret);  return ret;  }    struct lnum  {  vector <int> a;  int base;  lnum(int num = 0, int base = 1000000000):base(base)  {  if (!num)  a.resize(1);  while(num)  {  a.pb(num % base);  num /= base;  }  }  inline int len() const  {  return a.size();  }  lnum & operator=(const lnum &l)  {  if (this != &l)  {  a = l.a;  base = l.base;  }  return *this;  }  inline friend lnum operator+(const lnum &l, const lnum &r)  {  lnum ret(0, l.base);  int base = l.base;  int ln = l.len(), rn = r.len();  int n = max(ln, rn);  ret.a.resize(n);  int o = 0;  for(int i = 0; i < n; ++i)  {  int s = o;  if (i < ln)  s += l.a[i];  if (i < rn)  s += r.a[i];  o = s >= base;  if (o)  s -= base;  ret.a[i] = s;  }  if (o)  ret.a.push_back(1);  return ret;  }  inline friend lnum operator-(const lnum &l, const lnum &r)  {  lnum ret(0, l.base);  int base = l.base;  int n = l.len();  int rn = r.len();  ret.a.resize(n);  int o = 0;  for(int i = 0; i < n; ++i)  {  int s = l.a[i] - o;  if (i < rn)  s -= r.a[i];  o = s < 0;  if (o)  s += base;  ret.a[i] = s;  }  if (ret.len() > 1 && !ret.a.back())  ret.a.pop_back();  return ret;  }    inline friend lnum operator*(const lnum &l, const lnum &r)  {  lnum ret(0, l.base);  int base = l.base;  if (l.len() * r.len() > 1000000)  {  vector<cbase> fa (l.a.begin(), l.a.end()), fb (r.a.begin(), r.a.end());  int n = 1;  while (n < max (l.len(), r.len()))  n <<= 1;  n <<= 1;  fa.resize (n), fb.resize (n);  fft (fa, false), fft (fb, false);  for (int i = 0; i < n; ++i)  fa[i] *= fb[i];  fft (fa, true);  ret.a.resize(n);  for (int i = 0; i < n; ++i)  ret.a[i] = int (fa[i].real() + 0.5);  int carry = 0;  for (int i=0; i < n; ++i)  {  ret.a[i] += carry;  carry = ret.a[i] / base;  ret.a[i] %= base;  }  }  else  {  ret.a.resize(l.len() + r.len());  for (int i = 0; i < l.len(); ++i)  for (int j = 0, carry = 0; j < r.len() || carry; ++j)  {  long long cur = ret.a[i + j] + (ll)l.a[i] * (j < r.len() ? r.a[j] : 0) + carry;  ret.a[i + j] = cur % base;  carry = cur / base;  }  }  while (ret.len() > 1 && !ret.a.back())  ret.a.pop_back();  return ret;  }  inline friend lnum operator/(const lnum &l, const int &r)  {  lnum ret(0, l.base);  ret.a.resize(l.len());  int carry = 0;  for(int i = l.len() - 1; i >= 0; --i)  {  long long cur = l.a[i] + (ll)carry * l.base;  ret.a[i] = cur / r;  carry = cur % r;  }  while (ret.len() > 1 && ret.a.back() == 0)  ret.a.pop_back();  return ret;  }        inline friend bool operator<(const lnum &l, const lnum &r)  {  if (l.len() < r.len())  return true;  if (l.len() > r.len())  return false;  int n = l.len();  for(int i = n - 1; i; --i)  {  if (l.a[i] < r.a[i])  return true;  if (l.a[i] > r.a[i])  return false;  }  return false;  }  inline friend bool operator>(const lnum &l, const lnum &r)  {  return r > l;  }  inline friend bool operator==(const lnum &l, const lnum &r)  {  if (l.len() != r.len())  return false;  int n = l.len();  for(int i = n - 1; i; --i)  {  if (l.a[i] != r.a[i])  return false;  }  return true;  }  inline friend bool operator!=(const lnum &l, const lnum &r)  {  return !(l == r);  }  inline void print()  {  if (base == 1000000000)  {  printf("%d", a.back());  for(int i = a.size() - 2; i >=0; --i)  printf("%09d", a[i]);  }  else  {  for(int i = a.size() - 1; i >= 0; --i)  printf("%d", a[i]);  }  }  };  int gcd(int a, int b)  {  if (a > b)  swap(a, b);  if (!a)  return a;  if (a == b)  return a;  if (a == 1)  return 1;  if (!(a & 1))  {  if (b & 1)  return gcd(a >> 1, b);  else  return gcd(a >> 1, b >> 1) << 1;  }  else  {  if (b & 1)  return gcd((b - a) >> 1, a);  else  return gcd(a, b >> 1);  }    }

int main()
{
    VI l, r;
    char c;
    int i = 1;
    while ((c = getchar()) != '\n')
    {
        if (c == 'l')
            r.push_back(i);
        else
            l.push_back(i);
        ++i;
    }
    reverse(all(r));
    fori(it, l)
        cout << *it << endl;
    fori(it, r)
        cout << *it << endl;
    return 0;
}


#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>
#include <cstring>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;

const int sz = (int)1e+6 + 1;
char s[sz];
int n;
vector<int> res, tmp;

int main()
{
#ifndef ONLINE_JUDGE
#define cin fin
	ifstream fin("omg.txt");
#endif
	cin.getline(s, sz);
	n = strlen(s);
	res.resize(n);
	tmp.resize(n);
	for (int i = 0, left = 0, right = n-1; i < n; ++i) {
		tmp[i] = s[i] == 'l'? right-- : left++;
	}
	for (int i = 0; i < n; ++i) {
		res[tmp[i]] = i+1;
	}
	for (int i = 0; i < n; ++i)	{
		cout << res[i] << endl;
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 1e6 + 10;
int n;
char s[maxn];
char * _s = s + 1;
struct link
{
    int num;
    link * l, * r;
    link(int _num):num(_num),l(NULL),r(NULL){};
    link * left(int num)
    {
        link * p = new link(num);
        p->l = this->l;
        p->r = this;
        if (p->l) p->l->r = p;
        this->l = p;
        return p;
    }
    link * right(int num)
    {
        link * p = new link(num);
        p->r = this->r;
        p->l = this;
        if (p->r) p->r->l = p;
        this->r = p;
        return p;
    }
};
link * cur = new link(1);
int main()
{
    gets(_s);
    n = strlen(_s);
    for (int i = 1 ; i < n; ++i)
        if (s[i] == 'l')
            cur = cur->left(i+1);
        else
            cur = cur->right(i+1);
    link * head = cur;
    while (head->l) head = head->l;
    while (head)
        printf("%d\n",head->num),head=head->r;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
#include <list>
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,k,n) for(int i = (k); i < (int)(n); ++i)
#define FOREQ(i,k,n) for(int i = (k); i <= (int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); ++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v,h) memset((v),(h),sizeof(v))

int main() {
  string s;
  while(cin >> s) {
    list<int> l = {-1, -1};

    auto it = l.begin();
    REP(i, SZ(s)) {
      ++it;
      l.insert(it, i);
      advance(it, s[i] == 'l' ? -2 : -1);
    }

    for(auto const n: l) {
      if(n != -1) cout << n+1 << endl;
    }
  }
}


#include <set>
#include <map>
#include <list>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <cctype>
#include <sstream>
#include <iostream>
#include <algorithm>

#define MOD(x, n) ((x)%(n)+(n))%(n)
#define SZ(x) (int((x).size()))
#define ALL(x) ((x).begin()),((x).end())
int GCD( int a , int b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; }
int LCM( int a , int b ) { return a * ( b / GCD( a , b ) ) ; }

using namespace std;

list<int> solve(string &s, int i) {
    if(i == s.size()) {
        return list<int>(1, i);
    }

    list<int> ss = solve(s, i+1);
    if(s[i-1] == 'l') {
        ss.push_back(i);
    } else {
        ss.push_front(i);
    }
    return ss;
}

int main() {
    //freopen("input.txt", "r", stdin);

    string s;
    cin >> s;

    list<int> ss = solve(s, 1);
    for(int el : ss) {
        cout << el << endl;
    }

    return 0;
}


#include <cstdio>

char buf[1000001];

int main() {
    std::scanf("%s", buf); int i = 0;
    for (; buf[i] != '\0'; i++) if (buf[i] == 'r') std::printf("%d\n", i + 1);
    for (i--; i != -1; i--) if (buf[i] == 'l') std::printf("%d\n", i + 1);
}


#include <iostream>
#include <sstream>
#include <vector>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <list>
using namespace std;

void solve(istream &in, ostream &out) {
  string str;
  in >> str;

  vector<int> l, r;
  int index = 0;
  for (char c : str)
    if (c == 'l')
      l.push_back(++index);
    else
      r.push_back(++index);

  for (auto iter = r.begin(); iter != r.end(); ++iter)
    out << *iter << endl;
  for (auto iter = l.rbegin(); iter != l.rend(); ++iter)
    out << *iter << endl;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <list>
using namespace std;

void solve(istream &in, ostream &out) {
  string str;
  in >> str;

  list<int> a;
  auto iter = a.begin();
  for (int i = 0; i < str.size(); ++i) {
    iter = a.insert(iter, i + 1);
    if (str[i] == 'r')
      ++iter;
  }

  for (int i : a)
    out << i << endl;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;

void solve(istream &in, ostream &out) {
  string str;
  in >> str;

  vector<int> a;
  auto iter = a.begin();
  for (int i = 0; i < str.size(); ++i) {
    iter = a.insert(iter, i + 1);
    if (str[i] == 'r')
      ++iter;
  }

  for (int i = 0; i < a.size(); ++i)
    out << a[i] << endl;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <set>
using namespace std;

void solve(istream &in, ostream &out) {
	string s;
	in >> s;

	vector<int> lefts;
	for (size_t i = 0; i < s.size(); i++)
		if (s[i] == 'l')
			lefts.push_back(i + 1);
		else
			out << i + 1 << endl;
	while (!lefts.empty()) {
		out << lefts.back() << endl;
		lefts.pop_back();
	}
}

int main() {
	solve(cin, cout);
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

#define int ll
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v)  (v).begin(), (v).end()
#define rall(v)  (v).rbegin(), (v).rend()

#ifndef ONLINE_JUDGE
#define trace(x) { __trace(#x " = ", (x)); }
#else
#define trace(x) {}
#endif

using namespace std;

typedef long long ll;

template<class T> T __trace(string s, T x) { cerr << s << x << endl; return x; }

template<class T> ostream& operator<<(ostream& os, const vector<T>& v){ for(T x : v) os << x << " "; return os; }
template<class T> istream& operator>>(istream& is, vector<T>& v){ for(T& x : v) is >> x; return is; }

void run() {

  /* entry point */
  string s;
  cin >> s;

  int n = s.size();

  vector<int> v(n);

  int hd = 0;
  int tail = n-1;

  rep(i, n) {
    if(s[i] == 'l') {
      v[tail] = i+1;
      tail--;
    }
    else {
      v[hd] = i+1;
      hd++;
    }
  }

  rep(i, n) {
    cout << v[i] << endl;
  }

}

#undef int
int main() { run(); return 0; }


#include <cstdio>
#include <cstring>

char s[1000005];
int v[1000005];

int main() {

  scanf("%s", s);

  int n = strlen(s);

  int* hd = v;
  int* tail = v + n - 1;

  for(char* sp = s, i = 0; i < n; sp++, i++) {
    if(*sp == 'l') {
      *tail = i+1;
      tail--;
    }
    else {
      *hd = i+1;
      hd++;
    }
  }

  for(int* p = v, i = 0; i < n; p++, i++) {
    printf("%d\n", *p);
  }

  return 0;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin>>s;

    vector<int> left,right;

    for(int i=0;i<s.length();++i)
    {
        if(s[i]=='l')
            right.push_back(i+1);
        else
            left.push_back(i+1);
    }

    for(int i=0;i<left.size();++i)
        cout<<left[i]<<endl;

    reverse(right.begin(),right.end());
    for(int i=0;i<right.size();++i)
        cout<<right[i]<<endl;

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<random>
#include<algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    int len = s.length();
    int x = 0 , y = len - 1;
    int t [ len ] = {0};

    for ( int i = 0; i < len ; i ++ ) {
        if ( s [ i ]  == 'l' ) {
            t [ y ] = 1 + i;
            y -- ;
        }else {
            t [ x ] = 1 + i ;
            x ++;
        }
    }

    for ( int i = 0; i < len ; i++) {
        cout << t[i]<<endl;
    }

}


#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<random>
#include<algorithm>
using namespace std;

int main() {
    char s[1000000+11];
    cin >> s;
    int len = strlen(s);
    int x = 0 , y = len - 1;
    int t [ 1000006 ] = {0};

    for ( int i = 0; i < len ; i ++ ) {
        if ( s [ i ]  == 'l' ) {
            t [ y ] = 1 + i;
            y -- ;
        }else {
            t [ x ] = 1 + i ;
            x ++;
        }
    }

    for ( int i = 0; i < len ; i++) {
        cout << t[i]<<endl;
    }

}


#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<random>
#include<algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    int len = s.length();
    int x = 0 , y = len - 1;
    int t [ 1000006 ] = {0};

    for ( int i = 0; i < len ; i ++ ) {
        if ( s [ i ]  == 'l' ) {
            t [ y ] = 1 + i;
            y -- ;
        }else {
            t [ x ] = 1 + i ;
            x ++;
        }
    }

    for ( int i = 0; i < len ; i++) {
        cout << t[i]<<endl;
    }

}


#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<random>
#include<algorithm>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    char s[1000000+11];
    cin >> s;
    int len = strlen(s);
    int x = 0 , y = len - 1;
    int t [ 1000006 ] = {0};

    for ( int i = 0; i < len ; i ++ ) {
        if ( s [ i ]  == 'l' ) {
            t [ y ] = 1 + i;
            y -- ;
        }else {
            t [ x ] = 1 + i ;
            x ++;
        }
    }

    for ( int i = 0; i < len ; i++) {
        cout << t[i]<<endl;
    }

}


#include<cstring>
#include<cstdio>
#include<cstdlib>

using namespace std;

int main() {
    char s[1000000+11];
    scanf("%s", &s);
    int len = strlen(s);
    int x = 0 , y = len - 1;
    int t [ 1000006 ] = {0};

    for ( int i = 0; i < len ; i ++ ) {
        if ( s [ i ]  == 'l' ) {
            t [ y ] = 1 + i;
            y -- ;
        }else {
            t [ x ] = 1 + i ;
            x ++;
        }
    }

    for ( int i = 0; i < len ; i++) {
        printf("%d\n", t[ i ]);
    }

}


#include<iostream>
#include<string>
#include<vector>
#include<functional>
#include<algorithm>
#include<set>
#include<queue>

using namespace std;

typedef long long ll;

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin >> s;

    int len = s.length();
    vector<int> a(len+2);
    int l = 0, r = len+1;
    for(int i=0;i<len;++i)
    {
        if(s[i]=='l')
        {
            a[r--]=i+1;
        }
        else
        {
            a[l++]=i+1;
        }
    }
    for(int i=0;i<=len+1;++i)
    {
        if(a[i]) cout << a[i] << endl;
    }
    return 0;
}


#include <stdio.h>
#include <math.h>

char s[1<<20];

int main()
{
	int i;
	scanf(" %s", s);
	for ( i = 0; s[i]; ++i )
		if ( s[i] == 'r' )
			printf("%d\n", i+1);
	while ( --i >= 0 )
		if ( s[i] != 'r' )
			printf("%d\n", i+1);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct list
{
    int num;
    struct list* prev;
    struct list* next;
};

struct list* go_left(struct list* p, int num)
{
    if(p -> prev == NULL)
    {
        struct list* my_p;
        my_p = (struct list*) malloc(sizeof(struct list));
        my_p -> next = p;
        my_p -> prev = NULL;
        my_p -> num = num;
        p -> prev = my_p;
        return my_p;
    }
    struct list* my_p;
    my_p = (struct list*) malloc(sizeof(struct list));
    my_p -> prev = p -> prev;
    my_p -> next = p;
    p -> prev = my_p;
    my_p -> prev -> next = my_p;
    my_p -> num = num;
    return my_p;
}

struct list* go_right(struct list* p, int num)
{
    if(p -> next == NULL)
    {
        struct list* my_p;
        my_p = (struct list*) malloc(sizeof(struct list));
        my_p -> prev = p;
        my_p -> next = NULL;
        my_p -> num = num;
        p -> next = my_p;
        return my_p;
    }
    struct list* my_p;
    my_p = (struct list*) malloc(sizeof(struct list));
    my_p -> next = p -> next;
    my_p -> prev = p;
    p -> next = my_p;
    my_p -> next -> prev = my_p;
    my_p -> num = num;
    return my_p;
}

void print_list(struct list* p, int maxnum)
{
    struct list* g;
    g = p;

    while(g -> prev != NULL)
    {
        g = g -> prev;
    }
    if (g -> num != maxnum)
    {
        printf("%d\n", g -> num);
    }
    while((g = g -> next) != NULL)
    {
        if (g -> num != maxnum)
        {
            printf("%d\n", g -> num);
        }
    }

}

int main()
{
    struct list* my_list;
    my_list = (struct list*) malloc(sizeof(struct list));
    my_list -> num = 1;
    my_list -> next = my_list -> prev = NULL;

    char s[1000000];
    scanf("%1000000s", s);

    int n, i;
    n = strlen(s);

    for(i = 0; i < n; i++)
    {
        if(s[i] == 'r')
        {
            my_list = go_right(my_list, i+2);
        }
        else
        {
            my_list = go_left(my_list, i+2);
        }
    }
    print_list(my_list, n+1);
    return 0;
}


#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#define max(A,B) (A>B?A:B)
#define TEST 0
void debug()
{
     #if TEST
     freopen("d:\\in.txt","r",stdin);
     #endif
}
struct stone
{
    int num;
    struct stone *pre,*next;
};
void clear(struct stone *x)
{
    if(x->next!=NULL)
        clear(x->next);
    free(x);
}
char s[1000000];
int main()
{
    int n,i,len;
    struct stone *first,*now,*t,*a;
    first=now=malloc(sizeof(struct stone));
    now->next=NULL;
    now->num=1;
    now->pre=NULL;
    scanf("%s",s);
    len=strlen(s);
    for(i=0;i<len-1;i++)
    {
        if(s[i]=='l')
        {
            t=malloc(sizeof(struct stone));
            t->num=i+2;
            t->pre=now->pre;
            t->next=now;
            if(now->pre!=NULL)
                now->pre->next=t;
            now->pre=t;
            now=t;
        }
        else
        {
            t=malloc(sizeof(struct stone));
            t->num=i+2;
            t->next=now->next;
            t->pre=now;
            if(now->next!=NULL)
                now->next->pre=t;
            now->next=t;
            now=t;
        }
        if(now->pre==NULL)
            first=now;
    }
    while(first!=NULL)
    {
        printf("%d\n",first->num);
        first=first->next;
    }

    return 0;
}


#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#define max(A,B) (A>B?A:B)
#define TEST 0
void debug()
{
     #if TEST
     freopen("d:\\in.txt","r",stdin);
     #endif
}
struct stone
{
    int num;
    double po;
}x[1000000];
char s[1000000];
int cmp(struct stone *a,struct stone *b)
{
    if(a->po>b->po)return 1;
    else return 0;
}
int main()
{
    double rs,ls;
    int i,len,n;
    scanf("%s",s);
    for(i=0,rs=1,rs=0;s[i]!='\0';i++)
    {
        x[i].po=(rs+ls)/2;
        x[i].num=i+1;
        if(s[i]=='r')ls=x[i].po;
        else rs=x[i].po;
    }
    qsort(x,i,sizeof(x[0]),cmp);
    for(n=0;n<i;n++)
        printf("%d\n",x[n].num);
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	char a[1000010];
	scanf("%s", a);
	int n = strlen(a), i;
	int ans[1000010];
	int start = 0, end = n-1;
	for(i=0; i<n; i++)
	{
		if(a[i]=='r')
		{
			ans[start++] =i+1;
		}
		else
			ans[end--] = i+1;
	}
	for(i=0; i<n; i++)
	{
		printf("%d\n", ans[i]);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
double max(double a,double b){
	return a>b?a:b;
}
struct storage{
	int index;
	double val;
}str[1000005];
int cmp(struct storage *a,struct storage *b){
	return ceil(a->val - b->val);
}
char arr[1000005];
int main(){
	double left = 0; double right = 1; double mid = (left+right)/2;
	gets(arr);
	int len = strlen(arr);
	int k=0;
	int i;
	for(i=0;i<len;i++){
		str[k].val = mid; str[k].index = i+1; k++;
		if(arr[i]=='l'){
		right=(left+right)/2;
		}
		else{
		left=(left+right)/2;
		}
		mid=(left+right)/2;
	}
	qsort(str,k,sizeof(struct storage),cmp);
	for(i=0;i<k;i++){
		printf("%d\n",str[i].index);
	}

	}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int arr[1250000][2];
char input[1250000];
int main(){
	int a,b,c,d,e,f;
	int k=0;
	gets(input);
	int i; int len=strlen(input);
	for(i=0;i<len;i++){
		if(input[i]=='r'){
			printf("%d\n",i+1);
		}
		else{
		arr[k++][0]=i+1;
		}
	}
	for(i=k-1;i>=0;i--){
		printf("%d\n",arr[i][0]);
	}

}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#define EPS 10e-6
struct storage{
	int index;
	double val;
}str[1000005];
char arr[1000005];
int main(){
	double left = 0; double right = 1; double mid = (left+right)/2; int a;
	gets(arr);
	int len = strlen(arr);
	int k=0;
	int i;
	for(i=0;i<len;i++){
		str[k].val = mid; str[k].index = i+1; k++;
		if(arr[i]=='l'){
		right=(left+right)/2;
		}
		else{
		left=(left+right)/2;
		}
		mid=(left+right)/2;
	}
	int all=0;

	do{
    all=0;
    for(a=0;a<k-1;a++){
        if(str[a].val>str[a+1].val){
            struct storage temp = str[a];
            str[a]=str[a+1];
            str[a+1]=temp;
            all=1;
        }
    }
	}while(all);

	for(i=0;i<k;i++){
		printf("%d\n",str[i].index);
	}

	}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int arr[250000][2];
char input[250000];
int main(){
	int a,b,c,d,e,f;
	int k=0;
	gets(input);
	int i; int len=strlen(input);
	for(i=0;i<len;i++){
		if(input[i]=='r'){
			printf("%d\n",i+1);
		}
		else{
		arr[k++][0]=i+1;
		}
	}
	for(i=k-1;i>=0;i--){
		printf("%d\n",arr[i][0]);
	}

}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
double max(double a,double b){
	return a>b?a:b;
}
struct storage{
	int index;
	double val;
}str[1000005];
int cmp(struct storage *a,struct storage *b){
    double res = a->val - b->val;
	if(res<0)
        return -1;
    else if(res>0)
        return 1;
    else return 0;
}
char arr[1000005];
int main(){
	double left = 0; double right = 1; double mid = (left+right)/2;
	gets(arr);
	int len = strlen(arr);
	int k=0;
	int i;
	for(i=0;i<len;i++){
		str[k].val = mid; str[k].index = i+1; k++;
		if(arr[i]=='l'){
		right=(left+right)/2;
		}
		else{
		left=(left+right)/2;
		}
		mid=(left+right)/2;
	}
	qsort(str,k,sizeof(struct storage),cmp);
	for(i=0;i<k;i++){
		printf("%d\n",str[i].index);
	}

	}


#include<stdio.h>
#include<string.h>
char st[1000001];
int main()
{
scanf("%s",st);
int l=strlen(st);
int arr[l];
int f,la,i;
f=0;
la=l-1;
int k=1;
i=0;
while(st[i]!='\0')
{
if(st[i]=='l')
arr[la--]=k++;
else
{
arr[f++]=k++;
}
i++;
}
for(i=0;i<l;i++)
printf("%d\n",arr[i]);
return 0;
}


#include <stdio.h>
#include <string.h>
#include <conio.h>
int main(void)
{
    long int d,k,j,i,a[100001];
    char s[100000];

   scanf("%s",&s);
   d=strlen(s);
    i=1;
    j=strlen(s);
    for (k=1;k<=d;k++)
    {
    	if (s[k-1]=='l')
      {
      	a[j]=k;
      	j--;
      }
      else
      {
      	a[i]=k;
         i++;
      }
    }

	for (k=1;k<=d;k++)
   	printf("%d\n",a[k]);
   return 0;
}


#include <stdio.h>
#include <string.h>
#include <conio.h>
int main(void)
{
    long int k,j,i,a[1000001];
    char s[1000000];

   scanf("%s",&s);
    i=1;
    j=strlen(s);
    for (k=1;k<=strlen(s);k++)
    {
    	if (s[k-1]=='l')
      {
      	a[j]=k;
      	j--;
      }
      if (s[k-1]=='r')
      {
      	a[i]=k;
         i++;
      }
    }
	for (k=1;k<=strlen(s);k++)
   	printf("%d\n",a[k]);

   return 0;
}


#include <stdio.h>
#include <string.h>
#include <conio.h>
int main(void)
{
    unsigned int d,k,j,i,a[1000001];
    char s[1000000];

   scanf("%s",&s);
   d=strlen(s);
    i=1;
    j=strlen(s);
    for (k=1;k<=d;k++)
    {
    	if (s[k-1]==108)
      {
      	a[j]=k;
      	j--;
      }
      else
      {
      	a[i]=k;
         i++;
      }
    }

	for (k=1;k<=d;k++)
   	printf("%d\n",a[k]);
   return 0;
}


#include <stdio.h>
#include <string.h>
#include <conio.h>
int main(void)
{
    long int d,k,j,i,a[100001];
    char s[100000];

   scanf("%s",&s);
   d=strlen(s);
    i=1;
    j=strlen(s);
    for (k=1;k<=d;k++)
    {
    	if (s[k-1]=='l')
      {
      	a[j]=k;
      	j--;
      }
      else
      {
      	a[i]=k;
         i++;
      }
    }

	for (k=1;k<=d;k++)
   	printf("%d\n",a[k]);
   getch();
   return 0;
}


#include <stdio.h>
#include <string.h>

int main() {
	int i, l;
	static char s[1000001];

	scanf("%s", s);
	l = strlen(s);
	for (i = 0; i < l; i++)
		if (s[i] == 'r')
			printf("%d\n", i + 1);
	for (i = l - 1; i >= 0; i--)
		if (s[i] == 'l')
			printf("%d\n", i + 1);
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    char *s=(char *)malloc(1000000*sizeof(char));
    scanf("%s",s);
    int i;
    for(i=0;s[i];i++)
        if(s[i]=='r')
            printf("%d\n",i+1);
    for(i=strlen(s)-1;i>=0;i--)
        if(s[i]=='l')
            printf("%d\n",i+1);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAXN 1000002
typedef struct {
	double k;
	int v;
} node_t;

node_t nodes[MAXN];
char s[MAXN];

int cmp(const void *p1, const void *p2) {
	node_t *a = (node_t*)p1;
	node_t *b = (node_t*)p2;
	if (a->k < b->k) {
		return -1;
	}
	return 1;
}

void solve() {
	double left = 0.0;
	double right = 1.0;
	double mid;
	int len = strlen(s);
	int i;
	for (i = 0;i < len; i++) {
		mid = (left + right) * 0.5;
		nodes[i].k = mid;
		nodes[i].v = i + 1;
		if (s[i] == 'l') {
			right = mid;
		} else {
			left = mid;
		}
	}
	qsort((void*)nodes, len, sizeof(node_t), cmp);
	for (i = 0;i < len; i++) printf("%d\n", nodes[i].v);
}

int main() {
	scanf("%s", s);
	solve();
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node_t {
    struct node_t *next;
    int no;
} node_t;

#define MAXN 1000015

node_t nodes[MAXN];
node_t *head;
node_t *tail;

int tot;
char s[MAXN];

void list_add(node_t *node, node_t *curr) {
    curr->next = node->next;
    node->next = curr;
}

void solve() {
    node_t *left;
    node_t *right;
    node_t *curr;
    int len;
    int i;
    tot = -1;
    head = &nodes[++tot];
    tail = &nodes[++tot];
    head->next = tail;
    tail->next = NULL;
    head->no = -1;
    tail->no = -1;

    left = head;
    right = tail;
    len = strlen(s);
    for (i = 0;i < len; i++) {
        curr = &nodes[++tot];
        curr->no = i + 1;
        list_add(left, curr);
        if (s[i] == 'l') {
            right = curr;
        } else {
            left = curr;
        }
    }
    for (curr = head->next;curr != tail; curr = curr->next) {
        printf("%d\n", curr->no);
    }
}

int main() {
    scanf("%s", s);
    solve();
    return 0;
}


#include <stdio.h>

char string[1000000];
int main()
{
    int i;
    scanf("%s",string);
    int len=sizeof(string)/sizeof(char);
    for( i=0;i<len;i++){
            if(string[i]=='r')
                printf("%d\n",i+1);
        }
        for( i=len-1;i>=0;i--){
            if(string[i]=='l'){
                printf("%d\n",i+1);
            }
        }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
  string  string;
  cin>>string;
  for(int i=0;i<string.length();i++){
            if(string[i]=='r')
            cout<<(i+1)<<"\n";
        }
        for(int i=string.length()-1;i>=0;i--){
            if(string[i]=='l'){
                cout<<(i+1)<<"\n";
            }
        }
   return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	char b[1000001];
	int a[1000001],i,t=0,n,k;
	scanf("%s",b);
	n=strlen(b);
	for(i=0;i<n;i++)
	{
		if(b[i]=='l'){a[t]=i+1;t++;}
		else printf("%d\n",i+1);
	}
	t--;
	for(;t>=0;t--)printf("%d\n",a[t]);

	return 0;

}


#include <stdio.h>
#include <string.h>

int main()
{
	char s[1000001];
	int i, size;

	// input
	scanf("%s", s);
	size = strlen(s);

	// imprime todos os 'r' de forma crescente
	// sempre que a Liss se move para a direita, temos o próximo intervalo mais pequeno
	// pois estamos a subir de 0 e nunca mais descemos abaixo deste valor novamente
	for(i=0; i<size; i++) {
		if(s[i] == 'r') {
			printf("%d\n", i+1);
		}
	}

	// imprime todos os 'l' de forma decrescente
	// como descemos de 1, os últimos 'l' efectuados são os números mais baixos
	for(i=size-1; i>=0; i--) {
		if(s[i] == 'l') {
			printf("%d\n", i+1);
		}
	}

	return 0;
}


#include<stdio.h>
#include<string.h>
int i,j,k,l,t,n;
char s[1000010];
int main(){
gets(s);
l=strlen(s);
for(i=0;i<l;i++){
    if(s[i]=='r'){printf("%d\n",i+1);}
}
for(i=l-1;i>=0;i--){
if(s[i]=='l'){printf("%d\n",i+1);}
}
return 0;
}


#include<stdio.h>
int main()
{
	int stack[1000003];
	int top=0;
	int pos=1;
	char ch=1;
	while(scanf("%c",&ch)!=EOF && ch!='\n' && ch!='\0')
	{
		if(ch=='l')
		{
			stack[top++]=pos;
		}
		else
			printf("%d\n",pos);
		pos++;
	}
	while(top>0)
	{
		top--;
		printf("%d\n",stack[top]);
	}
	return 0;
}


//C. Escape from Stones
#include<stdio.h>
#include<string.h>
int main()
{
    char s[1000003];
    scanf("%s",s);
    int i,l,b,e;
    l=strlen(s);
    int a[l+3];
    b=0;
    e=l-1;
    for(i=0;i<l;i++)
    {
        if(s[i]=='l')
        {
            a[e] = i;
            e--;
        }
        else
        {
            a[b]= i;
            b++;
        }
    }
    for(i=0;i<l;i++)
    printf("%d\n",a[i]+1);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<memory.h>
#include<assert.h>
#include<ctype.h>

#define ll long long
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define abs(k) (((k)>0)?(k):(-(k)))
#define mod(a,b) (((a)>=0)?((a)-(b)*((a)/(b))):((a)-(b)*((a)/(b)+1))
#define mset(a) memset(a,0,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
#define mcmp(a,b,n) memcmp(a,b,n)
#define inf (1e9)
#define linf (1e18)
#define pi 3.14159265358979323846

void fileio_in_out()
{
     freopen(".in","r",stdin);
     freopen(".out","w",stdout);
}

void fileio_txt()
{
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
}

//==================================================

int n,head,tail;
int q[1111111];
char s[1111111];

int main()
{
    //fileio_in_out();
    //fileio_txt();

    int i,j,l;

    scanf("%s",s);
    n=strlen(s);
    head=n;
    tail=1;
    for(i=0;i<n;i++)
      if(s[i]=='l')
        q[head--]=i+1;
        else q[tail++]=i+1;
    for(i=1;i<=n;i++)
      printf("%d\n",q[i]);

    //system("pause");
    return 0;
}


#include <stdio.h>
char c;
void tr(long p){
	scanf("%c",&c);
	if(c=='r'){
		printf("%ld\n",p);
		tr(p+1);
	}else if(c=='l'){
		tr(p+1);
		printf("%ld\n",p);
	}
}

int main(){
	tr(1L);
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int sol[1000100];
char s[1000100];

int main(){

    scanf("%s", s);

    int i;
    int j = 0;
    int n = strlen(s)-1;
    for (i=0;i<strlen(s);i++){
        if (s[i]=='l'){
            sol[n--] = i;
        }
        else{
            sol[j++] = i;
        }
    }

    for (i=0;i<strlen(s);i++){
        printf("%d\n", sol[i]+1);
    }

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct t{
    double val;
    int idx;
} stones[1000100];

char s[1000100];

int cmp(const void *a, const void *b){
    struct t* ta = (struct t*)a;
    struct t *tb = (struct t*)b;
    if (ta->val>tb->val){
        return 1;
    }
    else if (ta->val<tb->val){
        return -1;
    }
    else{
        return 0;
    }
}

int main(){

    scanf("%s", s);
    double l = 0;
    double d = 1;
    int i;
    for (i=0;i<strlen(s);i++){
        stones[i].val = (l+d) / 2.0;
        stones[i].idx = i;
        if (s[i]=='l'){
            d = stones[i].val;
        }
        else{
            l = stones[i].val;
        }
    }

    qsort(stones, strlen(s), sizeof(struct t), cmp);
    for (i=0;i<strlen(s);i++){
        printf("%d\n", stones[i].idx + 1);
    }

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int sol[1000100];
char s[1000100];

int main(){

    scanf("%s", s);

    int i;
    int j = 0;
    int n = strlen(s)-1;
    int l = strlen(s);
    for (i=0;i<l;i++){
        if (s[i]=='l'){
            sol[n--] = i;
        }
        else{
            sol[j++] = i;
        }
    }

    for (i=0;i<l;i++){
        printf("%d\n", sol[i]+1);
    }

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct t{
    float val;
    int idx;
} stones[1000100];

char s[1000100];

int cmp(const void *a, const void *b){
    struct t* ta = (struct t*)a;
    struct t *tb = (struct t*)b;
    if (ta->val>tb->val){
        return 1;
    }
    else if (ta->val<tb->val){
        return -1;
    }
    else{
        return 0;
    }
}

int main(){

    scanf("%s", s);
    float l = 0;
    float d = 1;
    int i;
    for (i=0;i<strlen(s);i++){
        stones[i].val = (l+d) / 2.0;
        stones[i].idx = i;
        if (s[i]=='l'){
            d = stones[i].val;
        }
        else{
            l = stones[i].val;
        }
    }

    qsort(stones, strlen(s), sizeof(struct t), cmp);
    for (i=0;i<strlen(s);i++){
        printf("%d\n", stones[i].idx + 1);
    }

    return 0;
}


#include <stdio.h>
#include <stdlib.h>

//using namespace std;

int main()
{
  int n, i, l[1000000], r[1000000], tl, tr = 0;
  char c;
  for (i = 1; (c = getchar()) != '\n'; ++i){
    if (c == 'l') l[tl++] = i;
    else r[tr++] = i;
}
  for (i = 0; i < tr; ++i)
    printf("%d\n", r[i]);
   for (i = tl - 1; i >= 0; --i)
    printf("%d\n", l[i]);
  return 0;
}


#include <stdlib.h>
#include <stdio.h>

//using namespace std;

int main()
{
  int n, i, l[1000000], r[1000000], tl, tr = 0;
  char c;
  for (i = 1; (c = getchar()) != '\n'; ++i){
    if (c == 'l') l[tl++] = i;
    else r[tr++] = i;
}
  for (i = 0; i < tr; ++i)
    prinf("%d\n", r[i]);
   for (i = tl - 1; i >= 0; --i)
    prinf("%d\n", l[i]);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>

//using namespace std;

int main()
{
  int n, i, l[1000000], r[1000000], tl, tr = 0;
  char c;
  for (i = 1; (c = getchar()) != '\n'; ++i){
    if (c == 'l') l[tl++] = i;
    else r[tr++] = i;
}
  for (i = 0; i < tr; ++i)
    prinf("%d\n", r[i]);
   for (i = tl - 1; i >= 0; --i)
    prinf("%d\n", l[i]);
  return 0;
}


#include <stdlib.h>
#include <stdio.h>

//using namespace std;

int main()
{
  int n, i, l[1000000], r[1000000], tl, tr = 0;
  char c;
  for (int i = 1; (c = getchar()) != '\n'; i++){
    if (c == 'l') l[tl++] = i;
    else r[tr++] = i;
}
  for (i = 0; i < tr; i++)
    prinf("%d\n", r[i]);
   for (i = tl - 1; i >= 0; i--)
    prinf("%d\n", l[i]);
  return 0;
}


#include <stdio.h>

struct node
{int l,r;}tree[1000005];

int stack[1000005],top;

void dfs(int f)
{
    int i;

    i=1;
    while (i || top)
        if (i) {
            stack[top++]=i;
            i=tree[i].l;
        } else {
            --top;
            if (stack[top]!=f)
                printf("%d\n",stack[top]);
            i=tree[stack[top]].r;
        }
}

int main()
{
    int f,i,ch;

    for (f=1,i=2; (ch=getchar())=='l' || ch=='r'; f=i++)
        if (ch=='l')
            tree[f].l=i;
        else
            tree[f].r=i;
    dfs(f);
    return 0;
}


#include"stdio.h"
#include"string.h"
#include"stdlib.h"
#include"malloc.h"
#define LEN sizeof(struct pp)
#define inf 2100000000
int n,m,head,tail;
char s[1000001];
int q[3000000];

int main()
{
  int i,j,k,l;
  scanf("%s",s);
  l=strlen(s);
  l-=2;
  head=tail=1000001;
  q[head]=l+2;
  for(i=l;i>=0;i--)
  {
    if(s[i]=='r')
    {
      q[--head]=i+1;
    }
    else
    {
      q[++tail]=i+1;
    }
  }
  for(i=head;i<=tail;i++) printf("%d\n",q[i]);
  return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) REP(i,0,b)
#define si(n) scanf("%d",&n)
#define pi(n) printf("%d",n)
#define pin(n) printf("%d\n",n)
#define sort(arrr,n) qsort(arrr,n,sizeof(int),compare)
#define MIN(a,b) (a)<(b)?(a):(b)
#define MAX(a,b) (a)<(b)?(b):(a)
typedef struct node
{
    int a;
    struct node *l;
    struct node *r;
}node;
typedef node* ptr;
ptr head=NULL,current=NULL;
void left(int x)
{
    ptr p,q;
    p=current->l;
    q=malloc(sizeof(node));
    q->a=x;
    q->r=current;
    q->l=p;
    current->l=q;
    if(p!=NULL)p->r=q;
    current=q;
}
void right(int x)
{
    ptr p,q;
    p=current->r;
    q=malloc(sizeof(node));
    q->a=x;
    q->l=current;
    q->r=p;
    current->r=q;
    if(p!=NULL)p->l=q;
    current=q;
}
void print()
{
    while(current!=NULL)
    {
	pin(current->a);
	current=current->r;
    }
}
int abs(int a)
{
    if(a>0)
	return a;
    return -a;
}
int compare(const void * a, const void * b)
{
        return *(int*)a - *(int*)b;
}
char s[1000004];
int main()
{
    head=malloc(sizeof(node));
    head->a=1;
    head->l=head->r=NULL;
    current = head;
    scanf("%s",s);

    int l=strlen(s),i;
    rep(i,l-1)
    {
	if(s[i]=='l')
	    left(i+2);
	if(s[i]=='r')
	    right(i+2);
    }
    while((current->l)!=NULL)current=current->l;
    print();
    return 0;
}


#include<stdio.h>
int main()
{
    char c;
    int arr[1000001];
    int i=1,l=0;
    while(1)
    {
	c=getchar();
	if(c=='\n')
	    break;
	else if(c=='l')
	{
	    arr[l]=i;
	    i++;
	    l++;
	}
	else if(c=='r')
	{
	    printf("%d\n",i);
	    i++;
	}
    }
    for(i=l-1; i>=0; i--)
	printf("%d\n",arr[i]);
    return 0;
}


#include<stdio.h>

int main() {
    char s[1000006];
    scanf("%s",s);
    int i;
    for(i=0;i<strlen(s);i++) {
        if(s[i]=='r')
            printf("%d\n",i+1);
    }
    for(i=strlen(s)-1;i>=0;i--) {
        if(s[i]=='l')
            printf("%d\n",i+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
int main() {
    char s[1000006];
    scanf("%s",s);
    int i;
    int len = strlen(s);
    for(i=0;i<len;i++) {
        if(s[i]=='r')
            printf("%d\n",i+1);
    }
    for(i=len-1;i>=0;i--) {
        if(s[i]=='l')
            printf("%d\n",i+1);
    }
    return 0;
}


#include <stdio.h>
#include <string.h>
typedef int ll;
int main()
{
	char str[1000005];
	gets(str);
	ll i,k=0,a[1000001],n,p;
	p=strlen(str);
	n=p-1;;
	for(i=0;i<p;i++)
	{
		if(str[i]=='r')
			{
				a[k++]=i;
			}
		else
		{
				a[n--]=i;
		}
	}
	for(i=0;i<p;i++)
	{
		printf("%d\n",a[i]+1 );
	}
	return 0;
}


//sharky
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SI ({int x;scanf("%d",&x);x;})
#define SC ({char x;scanf("%c",&x);x;})
#define integer long long int
#define FOR(i,a,b) for (LL i = (a); i < (b); i++)
struct node{
	int a;
	struct node *left;
	struct node *right;
};
typedef struct node node;
char s[10000000];
int i;
int length;
void insert(node *temp){
	if(i == length)
		return;
	node *yeah = (node *)malloc(sizeof(node));
	yeah -> left = NULL;
	yeah -> right = NULL;
	if(s[i] == 'l'){
		if(i > 0 && s[i-1] == 'r'){
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
		else{
		temp->left = yeah;
		temp->right = NULL;
		temp = temp->left;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
	else if(s[i] == 'r'){
		if(i > 0 && s[i-1] == 'l'){
			temp->left = yeah;
			temp->right = NULL;
			temp = temp->left;
			temp -> a = i+1;
			i++;
			insert(temp);
		}
		else{
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
}
void preorder(node *temp){
	if(temp->left != NULL)
		preorder(temp->left);
	printf("%d\n",temp->a);
	if(temp->right != NULL)
		preorder(temp->right);
}

int main()
{
	scanf("%s",s);
	i=0;
	length = strlen(s);
	node *root = (node *)malloc(sizeof(node));
	node *temp = root;
	insert(root);
	if(temp->left == NULL)
		preorder(temp->right);
	else if(temp->right == NULL)
		preorder(temp->left);
	return 0;
}


//sharky
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SI ({int x;scanf("%d",&x);x;})
#define SC ({char x;scanf("%c",&x);x;})
#define integer long long int
#define FOR(i,a,b) for (LL i = (a); i < (b); i++)
struct node{
	int a;
	struct node *left;
	struct node *right;
};
typedef struct node node;
char s[10000000];
int i;
void insert(node *temp){
	if(i == strlen(s))
		return;
	node *yeah = (node *)malloc(sizeof(node));
	yeah -> left = NULL;
	yeah -> right = NULL;
	if(s[i] == 'l'){
		if(i > 0 && s[i-1] == 'r'){
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
		else{
		temp->left = yeah;
		temp->right = NULL;
		temp = temp->left;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
	else if(s[i] == 'r'){
		if(i > 0 && s[i-1] == 'l'){
			temp->left = yeah;
			temp->right = NULL;
			temp = temp->left;
			temp -> a = i+1;
			i++;
			insert(temp);
		}
		else{
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
}
void preorder(node *temp){
	if(temp->left != NULL)
		preorder(temp->left);
	printf("%d\n",temp->a);
	if(temp->right != NULL)
		preorder(temp->right);
}

int main()
{
	scanf("%s",s);
	i=0;
	node *root = (node *)malloc(sizeof(node));
	node *temp = root;
	insert(root);
	if(temp->left == NULL)
		preorder(temp->right);
	else if(temp->right == NULL)
		preorder(temp->left);
	return 0;
}


//sharky
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SI ({int x;scanf("%d",&x);x;})
#define SC ({char x;scanf("%c",&x);x;})
#define integer long long int
#define FOR(i,a,b) for (LL i = (a); i < (b); i++)
struct node{
	int a;
	struct node *left;
	struct node *right;
};
typedef struct node node;
char s[10000000];
int i;
void insert(node *temp){
	if(i == strlen(s))
		return;
	node *yeah = malloc(sizeof(node));
	if(s[i] == 'l'){
		if(i > 0 && s[i-1] == 'r'){
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
		else{
		temp->left = yeah;
		temp->right = NULL;
		temp = temp->left;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
	else if(s[i] == 'r'){
		if(i > 0 && s[i-1] == 'l'){
			temp->left = yeah;
			temp->right = NULL;
			temp = temp->left;
			temp -> a = i+1;
			i++;
			insert(temp);
		}
		else{
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
}
void preorder(node *temp){
	if(temp->left != NULL)
		preorder(temp->left);
	printf("%d\n",temp->a);
	if(temp->right != NULL)
		preorder(temp->right);
}

int main()
{
	scanf("%s",s);
	i=0;
	node *root = malloc(sizeof(node));
	node *temp = root;
	insert(root);
	if(temp->left == NULL)
		preorder(temp->right);
	else if(temp->right == NULL)
		preorder(temp->left);
//	preorder(temp);
	return 0;
}


//sharky
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SI ({int x;scanf("%d",&x);x;})
#define SC ({char x;scanf("%c",&x);x;})
#define integer long long int
#define FOR(i,a,b) for (LL i = (a); i < (b); i++)
struct node{
	int a;
	struct node *left;
	struct node *right;
};
typedef struct node node;
char s[10000000];
int i;
void insert(node *temp){
	if(i == strlen(s))
		return;
	node *yeah = (node *)malloc(sizeof(node));
	if(s[i] == 'l'){
		if(i > 0 && s[i-1] == 'r'){
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
		else{
		temp->left = yeah;
		temp->right = NULL;
		temp = temp->left;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
	else if(s[i] == 'r'){
		if(i > 0 && s[i-1] == 'l'){
			temp->left = yeah;
			temp->right = NULL;
			temp = temp->left;
			temp -> a = i+1;
			i++;
			insert(temp);
		}
		else{
		temp->right = yeah;
		temp->left = NULL;
		temp = temp->right;
		temp -> a = i+1;
		i++;
		insert(temp);
		}
	}
}
void preorder(node *temp){
	if(temp->left != NULL)
		preorder(temp->left);
	printf("%d\n",temp->a);
	if(temp->right != NULL)
		preorder(temp->right);
}

int main()
{
	scanf("%s",s);
	i=0;
	node *root = (node *)malloc(sizeof(node));
	node *temp = root;
	insert(root);
	if(temp->left == NULL)
		preorder(temp->right);
	else if(temp->right == NULL)
		preorder(temp->left);
	return 0;
}


#include<stdio.h>
#include<string.h>
main()
{
    char arr[1000010];
    int i,l;
    gets(arr);
    l=strlen(arr);
    for(i=0;i<l;i++)
    {
        if(arr[i]=='r')
            printf("%d\n",i+1);
    }
    for(i=l-1;i>=0;i--)
    {
        if(arr[i]=='l')
            printf("%d\n",i+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#define max(a,b) ((a>b)?a:b);
#define min(a,b) ((a<b)?a:b);
#define si(n) scanf("%d",&n);
#define ss(s) scanf("%s",s);
#define sort(a,n) qsort(a,n,sizeof(int),compare);
#define pi(n) printf("%d ",n);
#define ps(s) printf("%s",s);
#define loop(i,n) for(i=0;i<n;i++)
typedef long long int lld;
//#define MAX 100005
//int a[MAX];
       int compare(double *a,double *b)
       {
       return *a-*b;
       }

    int arr[1000001];
int main(void)
{
    //double arr[100000],mid;
    int i,n,ans,k,l,m;
    char s[1000005];
    ss(s);
    int start=0,end=1;
    int y=0,z=0;
    l=strlen(s);
    m=0,n=l-1;
    loop(i,l)
    {
	if(s[i]=='l')
	{
//	    pi(m);
	    arr[m++]=i+1;
	}
	else
	    arr[n--]=i+1;
    }
    for(i=l-1;i>=m;i--)
	printf("%d\n",arr[i]);
    for(i=m-1;i>=0;i--)
	printf("%d\n",arr[i]);
    /*for(i=l-1;i>m;i--)
	printf("%d\n",arr[i]);*/

    return 0;
}


#include <stdio.h>
#include <string.h>
int main()
{
	char str[1000001];
	scanf("%s",str);
	int i,w;
	w=strlen(str);
	for (i=0;i<w;i++){
		if (str[i]=='r'){
			printf("%d\n",i+1);
		}
	}
	for (i=w-1;i>=0;i--){
		if (str[i]=='l'){
			printf("%d\n",i+1);
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

int l[1000000], r[1000000];

int main(){
    int i, tl = 0, tr = 0;
    char c;
    for (i = 1 ; (c = getchar()) != '\n' ; ++i){
          if (c == 'l')l[tl++] = i;
          else r[tr++] = i;
    }
    for (i = 0 ; i < tr ; ++i)
        printf("%d\n", r[i]);
    for (i = tl - 1 ; i >= 0 ; --i)
        printf("%d\n", l[i]);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>

int main(){
    int i, l[100000], r[100000], tl = 0, tr = 0;
    char c;
    for (i = 1 ; (c = getchar()) != '\n' ; ++i){
          if (c == 'l')l[tl++] = i;
          else r[tr++] = i;
    }
    for (i = 0 ; i < tr ; ++i)
        printf("%d\n", r[i]);
    for (i = tl - 1 ; i >= 0 ; --i)
        printf("%d\n", l[i]);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int ar[1000005];
char str[1000005];
int len,i,k;

int main(){
	scanf("%s", str);
	for(i=0; str[i]; i++){
		if(str[i]=='l'){
			ar[k]=i+1;
			k++;
		} else {
			printf("%d ", i+1);
		}
	}
	for(i=k; i--;){
		printf("%d ", ar[i]);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int ar[1000005];
char str[1000005];
int len,i,k;

int main(){
	scanf("%s", str);
	for(i=0; str[i]; i++){
		if(str[i]=='l'){
			ar[k]=i+1;
			k++;
		} else {
			printf("%d", i+1);
		}
	}
	for(i=k; i--;){
		printf("%d", ar[i]);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int n,head,tail;
int q[1111111];
char s[1111111];

int main()
{

    int i,j,l;

    scanf("%s",s);
    n=strlen(s);
    head=n;
    tail=1;
    for(i=0;i<n;i++)
      if(s[i]=='l')
        q[head--]=i+1;
        else q[tail++]=i+1;
    for(i=1;i<=n;i++)
      printf("%d\n",q[i]);

    return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int barr[100009];
char str[100009];
int main()
{

   int i,lft;

   gets(str);
   lft=strlen(str);

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else
        printf("%d\n",i+1);
        //barr[rit]=i+1;
   }

   for(i=lft+1;i<=strlen(str);i++)
    printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[1000003];
char str[1000003];
int main()
{
   int i,lft,rit;
   scanf("%s",str);
   lft=strlen(str); rit=1;

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l'){
        barr[lft]=i+1; lft--;
    }

    else{
        barr[rit]=i+1; rit++;
    }
   }

   for(i=1;i<=strlen(str);i++){
        //if(barr[i]!=0)
            printf("%d\n",barr[i]);
   }
  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[100002];
char str[100002];
int main()
{

   int i,lft;

   gets(str);
   lft=strlen(str);

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else
        printf("%d\n",i+1);
        //barr[rit]=i+1;
   }

   for(i=lft+1;i<=strlen(str);i++)
    printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[10009];
char str[10009];
int main()
{

   int i,lft;

   gets(str);
   lft=strlen(str);

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else
        printf("%d\n",i+1);
        //barr[rit]=i+1;
   }

   for(i=lft+1;i<=strlen(str);i++)
    printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int barr[10009];
char str[10009];
int main()
{

   int i,lft;

   gets(str);
   lft=strlen(str);

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else
        printf("%d\n",i+1);
        //barr[rit]=i+1;
   }

   for(i=lft+1;i<=strlen(str);i++)
    printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[1000003];
char str[1000003];
int main()
{
   int i,lft,rit;
   scanf("%s",str);
   lft=strlen(str); rit=1;

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l'){
        barr[lft--]=i+1; //lft--;
    }

    else{
        barr[rit++]=i+1; //rit++;
    }
   }

   for(i=1;i<=strlen(str);i++){
        //if(barr[i]!=0)
            printf("%d\n",barr[i]);
   }
  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[1000003];
   char str[1000003];
   int i,lft,rit;
int main()
{
   scanf("%s",str);
   lft=strlen(str); rit=1;

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else{
        barr[rit]=i+1;
        printf("%d\n",barr[rit++]);
    }
   }

   for(i=lft+1;i<=strlen(str);i++)
        printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[1000002];
   char str[1000002];
int main()
{

   int i,lft;

   gets(str);
   lft=strlen(str);

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else
        printf("%d\n",i+1);
        //barr[rit]=i+1;
   }

   for(i=lft+1;i<=strlen(str);i++)
    printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[1000003];
   char str[1000003];
   int i,lft,rit;
int main()
{
   scanf("%s",str);
   lft=strlen(str); rit=1;

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l')
        barr[lft--]=i+1;

    else
        printf("%d\n",i+1);
        //barr[rit]=i+1;
   }

   for(i=lft+1;i<=strlen(str);i++)
        printf("%d\n",barr[i]);

  return 0;
}


#include<stdio.h>
#include<string.h>
int barr[1000009]={0};
char str[1000009];
int main()
{
   int i,lft,rit;
   scanf("%s",str);
   lft=strlen(str); rit=1;

   for(i=0;i<strlen(str);i++){

    if(str[i]=='l'){
        barr[lft]=i+1; lft--;
    }

    else{
        barr[rit]=i+1; rit++;
    }
   }

   for(i=1;i<=strlen(str);i++){
        if(barr[i]!=0)
            printf("%d\n",barr[i]);
   }
  return 0;
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader s = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        char S[]=s.next().toCharArray();
        int count=0;
        Stack<Integer> E = new Stack<Integer>();
        for (char i:S)
        {
            count++;
            if (i=='r')
            {
                out.println(count);
            } else {
                E.push(count);
            }

        }
        while (!E.isEmpty())
        {
            out.println(E.pop());
        }

            out.flush();
        out.close();
        }
}

class InputReader{
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream){
        reader= new BufferedReader(new InputStreamReader (stream), 32768);
        tokenizer=null;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public String next(){
        while(tokenizer==null || !tokenizer.hasMoreTokens()){
            try{
                tokenizer=new StringTokenizer(reader.readLine());
            } catch (IOException e){
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}