The
Code:
else
        {
            col = i;
        }
should be
Code:
else
        col = input[i] - '0'
because you are wanting the numeric equivalent of digits '0' to '9'.

Also you'd want to output 'sbox[0][col]', NOT indexed by input[col].