Tips for the question
This problem bothered me a lot. So I decide to write something about it to help other people to solve it more quickly.
---------------------------------------------
1.unsigned char or getchar()(which returns int) must be used to deal with the input
---------------------------------------------
2.When you're testing the program you write, maybe you will find that your PC can't run correct answer(even your code is right)(at least on my local PC... My accepted code always output 0 be cause char such as ┌ is always regarded as two char(s?).
So here is how I check my program.
----------------------------------------------------------
This is the original sample:
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
...........┌─────┐................................
...........│.....│................................
....┌──────│.....│..........┌─┐...................
....│......│.....│..........│.│...................
....│......│.....│..........└─┘...................
....│......│....┌│────┐.............┌─┐...........
....│......└─────┘....│.............│.│...........
....│......│....│.....│.............└─┘...........
....│......│....│.....│.........┌──┐..............
....└──────┘....│.....│.........│..│..............
................│.....│.........│..│..............
................└─────┘.........└──┘..............
..................................................
..................................................
And I changed it to the figure below:
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
...........+,,,,,+................................
...........*.....*................................
....+,,,,,,*.....*..........+,+...................
....*......*.....*..........*.*...................
....*......*.....*..........+,+...................
....*......*....+*,,,,+.............+,+...........
....*......+,,,,,+....*.............*.*...........
....*......*....*.....*.............+,+...........
....*......*....*.....*.........+,,+..............
....+,,,,,,+....*.....*.........*..*..............
................*.....*.........*..*..............
................+,,,,,+.........+,,+..............
..................................................
..................................................
In this case my local PC gave the right answer.
You just need a little change to make it work (i.e. change the ascii)