// The "D21" class.
//By team.tempest
import java.awt.*;
import java.io.*;
public class D21
{
    public static void main (String[] args) throws IOException
    {

	BufferedReader BR = new BufferedReader (new FileReader ("DATA1.txt"));
	PrintWriter PW = new PrintWriter (new FileWriter ("OUT1.txt"));
	String str[] = new String [8];
	String str1;
	int count;
	for (int i = 0 ; i < 5 ; i++)
	{

	    str1 = "";
	    for (int j = 0 ; j < 8 ; j++)
		str [j] = "";
	    for (int k = 0 ; k < 8 ; k++)
		str [k] = BR.readLine ();
	    for (int l = 0 ; l < 7 ; l++)
	    {
		count = 0;
		for (int a = 0 ; a < 5 ; a++)
		{
		    if (str [l].charAt (a) == '#')
			count = count + 1;
		}
		str1 = str1 + count + "";
	    }
	    PW.println (str1);

	}
	BR.close ();
	PW.close ();
	// Place your program here.  'c' is the output console
    } // main method
} // D21 class

