Hotel room numbering Given an input of a "hotel" in ASCII art with a single room marked, output the
room number according to certain rules.

Here's an example of an ASCII hotel:

               ##
               ##
#####          ##
#####  ######  ##
#####  ######  ##
#####  ######  ##


Here are a few more things about the ASCII hotels:


Each "building" is represented by a rectangle of # characters, where each
# represents a "room".
The above hotel consists of three buildings. Each building is separated by
two columns of spaces, and the lowest "floor" will always be on the last
line.
Each building will always have anywhere from 1-9 "floors" (rows) and 1-9
"rooms" on each floor. There will also always be 1-9 buildings.
Rooms are numbered as follows: [building #][floor #][room on floor #]. For
example, let's mark a few rooms in the above drawing:

               ##
               ##
#####          ##
#####  ####$#  ##
##%##  ######  ##
#####  ######  #@


The room marked with the % is room 123 (building 1, floor 2, 3rd room on
floor). Similarly, the room marked with the $ is room 235, and the @ is
room 312.
Buildings, floors, and "nth room on floor"s are always 1-indexed.


The input will consist of an ASCII hotel with a single room replaced with an
asterisk (*). This is the room for which you must output the room number. The
input must be taken as a single string, but you may use commas as line
separators instead of newlines (in case your language of choice cannot take
multiline input or if it's shorter to take single-line input). You may
optionally require a trailing comma/newline. You may also pad lines with
trailing spaces to make the input a complete rectangle.

Since this is code-golf, the shortest code in bytes wins.

Test cases (contained within a single code block to conserve vertical space):

Input:
*

Output: 111

Input:
#  #  *  #  #

Output: 311

Input:
#####
#####
####*
#####
#####

Output: 135

Input:
         #####
         #####           ######
         #####           ######
#  #  #  #####  #  #  #  ######  *

Output: 911

Input:
#
#  #
#  #  ##
#  #  ##  ###
#  #  ##  ###  #####
#  #  ##  ###  ##*##  ########
#  #  ##  ###  #####  ########

Output: 523

Input:
           #
           *
           #
           #
           #
           #
           #
           #
#########  #  #

Output: 281

Input:
                        ########*
                        #########
                        #########
                        #########
                        #########
                        #########
                        #########
                        #########
#  #  #  #  #  #  #  #  #########

Output: 999
CJam, 34 31 bytes

qN/W%zSf-La%{_{s'*&amp;}#_)@@=}3*;\


This requires the input to be padded to a rectangle with spaces.

Try it online! Alternatively, run all test cases.

Explanation

qN/      e# Read input and split into lines.
W%z      e# Rotate 90° counter-clockwise.
Sf-      e# Remove all spaces from the rows.
La%      e# Split into buildings. We've now got a 3D array of rooms, where the first
         e# dimension is the building, the second the room number and the third is the
         e# the floor number.
{        e# Run this block three times. At each stage it will find the index of the "*"
         e# along the current dimension and leave the element at that index on the stack
         e# for the next round...
  _      e#   Duplicate the current array.
  {      e#   Find the index of the first element where this block yields something
         e#   truthy...
    s    e#     Flatten into a single string.
    '*&amp;  e#     Set intersection with "*".
  }#
  _)     e#   Duplicate the index and increment it, because the results should be 1-based.
  @@=    e#   Pull up the array and the other copy of the index and select the
         e#   corresponding element.
}3*
;\       e# We've now got the building, room and floor index on the stack, as well as the
         e# "*" character itself. We discard the character and swap the room and the floor
         e# floor number. When the three indices are printed back-to-back at the end of
         e# the program, that will yield the desired result.