Created
May 24, 2010 11:39
-
-
Save u1ik/411776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- solution for CF#14 problem A: http://codeforces.com/contest/14/problem/A?locale=en | |
import List | |
import Control.Monad | |
import Control.Applicative | |
solve rows = (reverseCols.cutCols.reverseCols.cutCols.filter notEmpty) rows | |
where reverseCols = map reverse | |
cutCols rows | all ((=='.').head) rows = cutCols $ map tail rows | |
| otherwise = rows | |
notEmpty = any (=='*') | |
main = do | |
[n, m] <- map read . words <$> getLine | |
rows <- replicateM n getLine | |
mapM_ putStrLn $ solve rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment