#include <iostream>
#include <string>
#include <vector>
bool solve( std::vector< unsigned long long >& segmentLengths, std::vector< unsigned long long >& moves, unsigned long long moveCount )
{
if ( segmentLengths.size() == 1 )
{
moveCount++;
moves.push_back( 1 );
std::cout << moveCount << "\n";
for ( int i = 0; i < moves.size(); ++i )
{
std::cout << moves.at( i ) << " ";
}
std::cout << "\n";
return true;
}
else
{
bool canSolve = true;
for ( unsigned long long i = 0; i < segmentLengths.size(); ++i )
{
if ( segmentLengths.size() == 1 )
{
canSolve = false;
}
}
if ( canSolve )
{
moves += segmentLengths.size();
for ( unsigned long long i = 0; i < segmentLengths.size() )
{
moves.push_back( 1 );
}
std::cout << moveCount << "\n";
for ( int i = 0; i < moves.size(); ++i )
{
std::cout << moves.at( i ) << " ";
}
std::cout << "\n";
return true;
}
int segment = 1;
for ( unsigned long long i = 0; i < segmentLengths.size(); ++i )
{
if ( segmentLengths.at( i ) > 1 )
{
std::vector< unsigned long long > newSegments( segmentLengths );
if ( i > 0 && i < segmentLengths.size() - 1 )
{
newSegments.at( i - 1 ) += newSegments.at( i + 1 );
newSegments.erase( newSegments.begin() + i );
}
newSegments.erase( newSegments.begin() + i );
if ( moves.size() > moveCount )
{
moves[ moveCount ] = segment;
}
else
{
moves.push_back( segment );
}
if ( solve( newSegments, moves, moveCount + 1 ) )
{
return true;
}
segment++;
}
}
}
return false;
}
int main()
{
std::ios_base::sync_with_stdio( false );
std::vector< unsigned long long > segmentLengths;
std::string input;
std::getline( std::cin, input );
bool lastBit = 0;
unsigned long long segmentLength = 1;
for ( unsigned long long i = 0; i < input.length(); ++i )
{
if ( i > 0 )
{
if ( lastBit == ( input[ i ] == '1' ) )
{
segmentLength++;
}
else
{
segmentLengths.push_back( segmentLength );
segmentLength = 1;
}
}
lastBit = input[ i ] == '1';
}
segmentLengths.push_back( segmentLength );
std::vector< unsigned long long > moves;
if ( !solve( segmentLengths, moves, 0 ) )
{
std::cout << "QAQ\n";
}
return 0;
}