Language: C++

import Debug.Trace

charToCode :: Char -> String
charToCode c = case c of
    ' ' ->"101"
    '\''->"000000"
    ',' ->"000011"
    '-' ->"10010001"
    '.' ->"010001"
    '?' ->"000001"
    'A' ->"100101"
    'B' ->"10011010"
    'C' ->"0101"
    'D' ->"0001"
    'E' ->"110"
    'F' ->"01001"
    'G' ->"10011011"
    'H' ->"010000"
    'I' ->"0111"
    'J' ->"10011000"
    'K' ->"0110"
    'L' ->"00100"
    'M' ->"10011001"
    'N' ->"10011110"
    'O' ->"00101"
    'P' ->"111"
    'Q' ->"10011111"
    'R' ->"1000"
    'S' ->"00110"
    'T' ->"00111"
    'U' ->"10011100"
    'V' ->"10011101"
    'W' ->"000010"
    'X' ->"10010010"
    'Y' ->"10010011"
    'Z' ->"10010000"

codeToChar :: String->Char
codeToChar s = case s of
    "00000"->'A'
    "00001"->'B'
    "00010"->'C'
    "00011"->'D'
    "00100"->'E'
    "00101"->'F'
    "00110"->'G'
    "00111"->'H'
    "01000"->'I'
    "01001"->'J'
    "01010"->'K'
    "01011"->'L'
    "01100"->'M'
    "01101"->'N'
    "01110"->'O'
    "01111"->'P'
    "10000"->'Q'
    "10001"->'R'
    "10010"->'S'
    "10011"->'T'
    "10100"->'U'
    "10101"->'V'
    "10110"->'W'
    "10111"->'X'
    "11000"->'Y'
    "11001"->'Z'
    "11010"->' '
    "11011"->'.'
    "11100"->','
    "11101"->'-'
    "11110"->'\''
    "11111"->'?'

solve :: String -> String
solve s = solve' code'
    where code = concat $ map charToCode s
          mod5 = (length code) `mod` 5
          n0 = if mod5==0 then 0 else (5-mod5)
          code' = code ++ (take n0 $ repeat '0')

solve' :: String -> String
solve' "" = ""
solve' code' = (codeToChar x):(solve' xs)
    where x = take 5 code'
          xs = drop 5 code'

main :: IO ()
main = do
    str <- getContents
    mapM_ putStrLn $ map solve $ lines $ str

Compiler output:
a.cc:74:16: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   74 | solve s = solve' code'
      |                ^~~~~~~
a.cc:76:32: error: stray '`' in program
   76 |           mod5 = (length code) `mod` 5
      |                                ^
a.cc:76:36: error: stray '`' in program
   76 |           mod5 = (length code) `mod` 5
      |                                    ^
a.cc:78:15: warning: multi-character literal with 29 characters exceeds 'int' size of 4 bytes
   78 |           code' = code ++ (take n0 $ repeat '0')
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:78:47: warning: missing terminating ' character
   78 |           code' = code ++ (take n0 $ repeat '0')
      |                                               ^
a.cc:78:47: error: missing terminating ' character
   78 |           code' = code ++ (take n0 $ repeat '0')
      |                                               ^~
a.cc:80:6: warning: missing terminating ' character
   80 | solve' :: String -> String
      |      ^
a.cc:80:6: error: missing terminating ' character
   80 | solve' :: String -> String
      |      ^~~~~~~~~~~~~~~~~~~~~
a.cc:81:6: warning: missing terminating ' character
   81 | solve' "" = ""
      |      ^
a.cc:81:6: error: missing terminating ' character
   81 | solve' "" = ""
      |      ^~~~~~~~~
a.cc:82:6: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   82 | solve' code' = (codeToChar x):(solve' xs)
      |      ^~~~~~~
a.cc:82:37: warning: missing terminating ' character
   82 | solve' code' = (codeToChar x):(solve' xs)
      |                                     ^
a.cc:82:37: error: missing terminating ' character
   82 | solve' code' = (codeToChar x):(solve' xs)
      |                                     ^~~~~
a.cc:83:26: warning: missing terminating ' character
   83 |     where x = take 5 code'
      |                          ^
a.cc:83:26: error: missing terminating ' character
a.cc:84:27: warning: missing terminating ' character
   84 |           xs = drop 5 code'
      |                           ^
a.cc:84:27: error: missing terminating ' character
a.cc:1:1: error: 'import' does not name a type
    1 | import Debug.Trace
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'