Problem:
Score : 100 points

Problem Statement

How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?

Constraints

1≤M≤23

M is an integer.

Input

Input is given from Standard Input in the following format:

M

Output

If we have x hours until New Year at M o'clock on 30th, December, print x.

Sample Input 1

21

Sample Output 1

27

We have 27 hours until New Year at 21 o'clock on 30th, December.

Sample Input 2

12

Sample Output 2

36

Solution in Haskell (GHC 7.10.3) (judge verdict: Accepted)

module Main (main) where

import qualified Data.ByteString.Char8     as C8
import           Data.Maybe

main :: IO ()
main = do
  [m] <- readInts
  print . showAnswer $ solve m

type Input  = (Int)
type Output = Int

solve :: Input -> Output
solve m = 48-m

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | Compare Ordering
  | Compare2 Ordering

instance Show Answer where
  show (YesNo b)   = if b then "Yes" else "No"
  show (YESNO b)   = if b then "YES" else "NO"
  show (AB b)      = if b then "A"   else "B"
  show (Number i)  = show i
  show (Compare o)
    | o == EQ = "="
    | o == LT = "<"
    | o == GT = ">"
  show (Compare2 o)
    | o == EQ = "Balanced"
    | o == LT = "Right"
    | o == GT = "Left"