Welcome
You could make an array like this
uint8_t array[][2] =
{
// mask, value
// S123456 S123456
{ 0b110110, 0b010000 },
{ 0b110101, 0b010101 },
{ 0b110101, 0b010100 },
{ 0b110110, 0b010010 },
{ 0b101110, 0b100000 },
...
};
Store the states of all switches in a single byte switchesStates (with bitWrite, for example, or you can possibly wire all switches so they are on the same input port, so you just have to read the port value)
Then you just have to loop the array, mask switchesStates with the first value of the array and compare the result with the second value, return index+1 if it matches
Something like this
for ( uint8_t i = 0; i < sizeof( array ) / sizeof( array[0] ); i++ )
{
if ( ( switchesStates & array[i][0] ) == array[i][1] )
{
return i+1;
}
}
return 0; // incorrect value