A. Letter
time limit per test

1 second

memory limit per test

64 megabytes

input

standard input

output

standard output

A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world economic crisis and high oil prices, he wants to send his creation, but to spend as little money as possible. For each sent square of paper (no matter whether it is shaded or not) Bob has to pay 3.14 burles. Please, help Bob cut out of his masterpiece a rectangle of the minimum cost, that will contain all the shaded squares. The rectangle's sides should be parallel to the sheet's sides.

Input

The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at least one square.

Output

Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better.

Sample test(s)
input
6 7
.......
..***..
..*....
..***..
..*....
..***..
output
***
*..
***
*..
***
input
3 3
***
*.*
***
output
***
*.*
***

代码

#include "stdio.h"
#include "string.h"
#include "stdlib.h"
char mapx[55][55];
int a,b;
int is_emh( int i ) {
{
int k=0,j;
for ( j=0; j<b; j++ ) {
if ( mapx[i][j]=='.' )
k++;
}
if ( k==b )
return 1;
return 0;
}
} int is_eml( int i ) {
{
int k=0;
int j;
for ( j=0; j<a; j++ ) {
if ( mapx[j][i]=='.' )
k++;
}
if ( k==a )
return 1;
return 0;
}
} int main( ) {
int i,j;
while ( ~scanf( "%d%d",&a,&b ) ) {
for ( i=0; i<a; i++ )
{
scanf( "%s",&mapx[i] );
} for ( i=0; i<a; i++ ) {
if ( is_emh( i ) )
continue;
for ( j=0; j<b; j++ ) {
if ( is_eml( j ) )
continue;
printf("%c",mapx[i][j]);
}
printf("\n");
}
}
return 0;
}

codeforce -14A A. Letter的更多相关文章

  1. codeforces 14A - Letter & codeforces 859B - Lazy Security Guard - [周赛水题]

    就像title说的,是昨天(2017/9/17)周赛的两道水题…… 题目链接:http://codeforces.com/problemset/problem/14/A time limit per ...

  2. codeforce 1311 C. Perform the Combo 前缀和

    You want to perform the combo on your opponent in one popular fighting game. The combo is the string ...

  3. [LeetCode] Letter Combinations of a Phone Number 电话号码的字母组合

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

  4. 17. Letter Combinations of a Phone Number

    题目: Given a digit string, return all possible letter combinations that the number could represent. A ...

  5. 什么是Unicode letter

    起因:从一段代码说起 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...

  6. LeetCode——Letter Combinations of a Phone Number

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

  7. No.017:Letter Combinations of a Phone Number

    问题: Given a digit string, return all possible letter combinations that the number could represent.A ...

  8. SCI/EI期刊投稿 Reply Letter 常用格式总结

    SCI/EI期刊投稿Reply Letter常用格式总结          整个论文投稿的过程中,会遇到各种问题,需要我们向主编询问或是回复.下面主要总结了responses to the comme ...

  9. 【leetcode】 Letter Combinations of a Phone Number(middle)

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

随机推荐

  1. Redis 主从,哨兵,集群实战

    下载地址及版本说明 Redis 各版本下载地址: http://download.redis.io/releases/ 版本说明:一般来说版本号第二位,偶数是稳定版本,奇数是在开发中的版本 本文基于R ...

  2. myql忽略大小写问题解决

    linux系统下启动mysql默认是区分大小写的,如果刚好项目中使用的表名与数据库中表名大小写有冲突,此时就需要忽略mysql表名大小写了. 解决方式一: 1.关闭数据库 mysqladmin -ur ...

  3. Python爬虫(一):爬虫伪装

    1 简介 对于一些有一定规模或盈利性质比较强的网站,几乎都会做一些防爬措施,防爬措施一般来说有两种:一种是做身份验证,直接把虫子挡在了门口,另一种是在网站设置各种反爬机制,让虫子知难而返. 2 伪装策 ...

  4. Kafka常用命令合集

    在上一篇文章<Linux安装Kafka>中,已经介绍了如何在Linux安装Kafka,以及Kafka的启动/关闭和创建发话题并产生消息和消费消息.这篇文章就介绍介绍Kafka的那些常用的命 ...

  5. Python celery和Redis入门安装使用(排难帖)

    1.redis安装 下载地址 https://github.com/MicrosoftArchive/redis/releases,选择Redis-x64-3.2.100.msi5.8 MB下载就好了 ...

  6. Centos6 日常使用小结

    网络配置目录 1./etc/sysconfig/network-script/ifcfg-eth0 2.netstat -rn Kernel IP routing table Destination ...

  7. Scala 学习笔记之集合(7) Option

    object CollectionDemo8 { def main(args: Array[String]): Unit = { //Option集合的使用,可以用来安全的判断null或非null,放 ...

  8. Video/audio标签的一些基础使用心得

    常用方法 .play():用于音频视频的播放 .pause():用于音频视频的暂停 常用属性 <audio src="Batmobile Battle Mode Reveal Musi ...

  9. 深入理解C# 委托(delegate)-戈多编程

    今天来谈谈委托,深入理解委托,本文来自各大神经验总结. 1.委托是什么? 委托类型的声明与方法签名相似. 它有一个返回值和任意数目任意类型的参数,是一种可用于封装命名方法或匿名方法的引用类型. 委托类 ...

  10. 洛谷 P3833 [SHOI2012]魔法树

    题目背景 SHOI2012 D2T3 题目描述 Harry Potter 新学了一种魔法:可以让改变树上的果子个数.满心欢喜的他找到了一个巨大的果树,来试验他的新法术. 这棵果树共有N个节点,其中节点 ...