Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    void Calc()
    {
        var dic = new Dictionary<char, string>
        {
{' ', "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"},
        };

        var dic2 = new Dictionary<string, char>
        {
{"11010", ' '},
{"11110", '\''},
{"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'},
{"11011", '.'},
{"11100", ','},
{"11101", '-'},
{"11111", '?'},
        };

        var str = Console.ReadLine();
        var conv = string.Concat(str.Select(x => dic[x]));
        var next = conv.Select((x, i) => new { x, i })
            .GroupBy(x => x.i / 5)
            .Select(x => string.Concat(x.Select(y => y.x)))
            .ToArray();
        if (next.Any())
            next[next.Length - 1] += string.Concat(Enumerable.Repeat('0', 5 - next[next.Length - 1].Length));
        Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
    }

    static void Main()
    {
        new Program().Calc();
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:97:2: error: expected ';' after class definition
   97 | }
      |  ^
      |  ;
a.cc: In member function 'void Program::Calc()':
a.cc:10:9: error: 'var' was not declared in this scope
   10 |         var dic = new Dictionary<char, string>
      |         ^~~
a.cc:46:13: error: expected ';' before 'dic2'
   46 |         var dic2 = new Dictionary<string, char>
      |             ^~~~
a.cc:82:13: error: expected ';' before 'str'
   82 |         var str = Console.ReadLine();
      |             ^~~
a.cc:83:13: error: expected ';' before 'conv'
   83 |         var conv = string.Concat(str.Select(x => dic[x]));
      |             ^~~~
a.cc:84:13: error: expected ';' before 'next'
   84 |         var next = conv.Select((x, i) => new { x, i })
      |             ^~~~
a.cc:84:54: error: expected primary-expression before ')' token
   84 |         var next = conv.Select((x, i) => new { x, i })
      |                                                      ^
a.cc:88:13: error: 'next' was not declared in this scope
   88 |         if (next.Any())
      |             ^~~~
a.cc:89:38: error: 'string' was not declared in this scope
   89 |             next[next.Length - 1] += string.Concat(Enumerable.Repeat('0', 5 - next[next.Length - 1].Length));
      |                                      ^~~~~~
a.cc:89:52: error: 'Enumerable' was not declared in this scope
   89 |             next[next.Length - 1] += string.Concat(Enumerable.Repeat('0', 5 - next[next.Length - 1].Length));
      |                                                    ^~~~~~~~~~
a.cc:90:9: error: 'Console' was not declared in this scope
   90 |         Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
      |         ^~~~~~~
a.cc:90:27: error: 'string' was not declared in this scope
   90 |         Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
      |                           ^~~~~~
a.cc:90:41: error: 'next' was not declared in this scope
   90 |         Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
      |                                         ^~~~
a.cc:90:53: error: 'x' was not declared in this scope
   90 |         Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
      |                                                     ^
a.cc:90:56: error: expected primary-expression before '>' token
   90 |         Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
      |                                                        ^
a.cc:90:58: error: 'dic2' was not declared in this scope
   90 |         Console.WriteLine(string.Concat(next.Select(x => dic2[x])));
      |                                                          ^~~~
a.cc: In static member function 'static void Program::Main()':
a.cc:95:22: error: expected ';' before '.' token
   95 |         new Program().Calc();
      |                      ^