Imports System.IO
Module Module1
    Dim parole As String
    Function Cut(ByVal x As String) As String
        If x.IndexOf(" ") = -1 Then
            Return x
        Else
            Dim line As String
            If x.IndexOf(" ") = 0 Then

                x = x.Substring(1)

                line = x
            Else : line = x.Substring(0, x.IndexOf(" "))
                x = x.Substring(1) + x.IndexOf(" ")
                line = line & x
            End If
            Return line
        End If
    End Function
    Function number(ByVal x As String) As Integer
        Dim n As Integer
        Do Until x = ""
            x = x.Substring(1)
            n += 1
        Loop
        Return n
    End Function
    Sub Converter()
        Dim Key(number(parole) - 1) As Integer
        For i As Integer = 0 To number(parole) - 1
            If parole.Substring(0, 1) = "A" Then
                Key(i) = 1
            ElseIf parole.Substring(0, 1) = "B" Then
                Key(i) = 2
            ElseIf parole.Substring(0, 1) = "C" Then
                Key(i) = 3
            ElseIf parole.Substring(0, 1) = "D" Then
                Key(i) = 4
            ElseIf parole.Substring(0, 1) = "E" Then
                Key(i) = 5
            ElseIf parole.Substring(0, 1) = "F" Then
                Key(i) = 6
            ElseIf parole.Substring(0, 1) = "G" Then
                Key(i) = 7
            ElseIf parole.Substring(0, 1) = "H" Then
                Key(i) = 8
            ElseIf parole.Substring(0, 1) = "I" Then
                Key(i) = 9
            ElseIf parole.Substring(0, 1) = "J" Then
                Key(i) = 10
            ElseIf parole.Substring(0, 1) = "K" Then
                Key(i) = 11
            ElseIf parole.Substring(0, 1) = "L" Then
                Key(i) = 12
            ElseIf parole.Substring(0, 1) = "M" Then
                Key(i) = 13
            ElseIf parole.Substring(0, 1) = "N" Then
                Key(i) = 14
            ElseIf parole.Substring(0, 1) = "O" Then
                Key(i) = 15
            ElseIf parole.Substring(0, 1) = "P" Then
                Key(i) = 16
            ElseIf parole.Substring(0, 1) = "Q" Then
                Key(i) = 17
            ElseIf parole.Substring(0, 1) = "R" Then
                Key(i) = 18
            ElseIf parole.Substring(0, 1) = "S" Then
                Key(i) = 19
            ElseIf parole.Substring(0, 1) = "T" Then
                Key(i) = 20
            ElseIf parole.Substring(0, 1) = "U" Then
                Key(i) = 21
            ElseIf parole.Substring(0, 1) = "V" Then
                Key(i) = 22
            ElseIf parole.Substring(0, 1) = "W" Then
                Key(i) = 23
            ElseIf parole.Substring(0, 1) = "X" Then
                Key(i) = 24
            ElseIf parole.Substring(0, 1) = "Y" Then
                Key(i) = 25
            ElseIf parole.Substring(0, 1) = "Z" Then
                Key(i) = 26
            End If
        Next i
    End Sub

    Sub Main()
        Dim reader As New StreamReader("INPUT.txt")
        Dim line As String = reader.ReadLine()
        Dim length As Integer = Integer.Parse(line.Substring(0, line.IndexOf(":")))
        line = line.Substring(line.IndexOf(":") + 1)
        Dim height As Integer = Integer.Parse(line)
        Parole = reader.ReadLine()
        reader.Close()
        Console.WriteLine("Enter the text")
        line = Console.ReadLine()
        line = Cut(line)
        Dim Mass(length - 1, height - 1) As String
        For i As Integer = 0 To length - 1
            For j As Integer = 0 To height - 1
                Mass(i, j) = line.Substring(0, 1)
                line = line.Substring(1)
            Next j
        Next i
        Converter()
        For i As Integer = 0 To number(parole) - 1
            If key(i) Then

            End If
        Next i
    End Sub

End Module
