public static void main(String[] args) {
		// TODO Auto-generated method stub
		TC.lectureDansFichier("doodle.txt");
		TC.ecritureDansNouveauFichier("out.txt");
		String s = TC.lireLigne();
		r = Integer.parseInt(TC.motsDeChaine(s)[0]);
		c = Integer.parseInt(TC.motsDeChaine(s)[1]);
		img = new boolean[r][c];
		colored = new boolean[r][c];
		
		int i = 0, j = 0;
		for (i = 0; i < r; i++) {
			s = TC.lireLigne();
			for (j = 0; j < c; j++) {
				if(s.charAt(j) == '#'){
					img[i][j] = true;
					blackList.add(new Coord(i,j));//add to blackList
				}
				else
					img[i][j] = false;
				colored[i][j]=false;
			}
		}
		System.out.println("data read! " + r + " " + c + " ");
		// /////////////////////////////////////////////////////
		
		System.out.println("5 5 1==>"+isSameColor(5, 5, 1));

		for(Coord coord:blackList){
			coord.max=findMax(coord.x, coord.y);
		}
		Collections.sort(blackList, new SqComparator());//sorted!!
		
		try {
			ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("list.data"));
			oos.writeObject(blackList);
//			ObjectInputStream ois = new ObjectInputStream(new FileInputStream("list.data"));
//			timetable = (String[][]) ois.readObject();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		
		int n=0;
		for(Coord coord:blackList){
			if(colored[coord.x][coord.y]==false){
				TC.println("PAINTSQ " + coord.x + " " + coord.y + " "+coord.max);
				n++;
				System.out.println(coord.max);
				changeSq(coord.x,coord.y,coord.max);
				}
		}
		
//		int n=printCmd();
		System.out.println(n);
		

		
	}//main