with Ada.Text_IO; use Ada.Text_IO;
procedure Q5F is
A : String(1 .. 100); -- Tamanho máximo da string A
B : String(1 .. 100); -- Tamanho máximo da string B
Len_A, Len_B : Natural;
Found : Boolean := False;
begin
-- Leitura das strings
Put_Line("Digite a string A:");
Get_Line(A, Len_A);
Put_Line("Digite a string B:");
Get_Line(B, Len_B);
-- Verifica se B está contido em A
for I in 1 .. Len_A - Len_B + 1 loop
if A(I .. I + Len_B - 1) = B then
Put_Line("A string B está contida em A na posição: " & Integer'Image(I));
Found := True;
exit; -- Encerra o loop ao encontrar
end if;
end loop;
if not Found then
Put_Line("A string B não está contida em A.");
end if;
end Q5F;
d2l0aCBBZGEuVGV4dF9JTzsgdXNlIEFkYS5UZXh0X0lPOwoKcHJvY2VkdXJlIFE1RiBpcwogICBBIDogU3RyaW5nKDEgLi4gMTAwKTsgLS0gVGFtYW5obyBtw6F4aW1vIGRhIHN0cmluZyBBCiAgIEIgOiBTdHJpbmcoMSAuLiAxMDApOyAtLSBUYW1hbmhvIG3DoXhpbW8gZGEgc3RyaW5nIEIKICAgTGVuX0EsIExlbl9CIDogTmF0dXJhbDsKICAgRm91bmQgOiBCb29sZWFuIDo9IEZhbHNlOwoKYmVnaW4KICAgLS0gTGVpdHVyYSBkYXMgc3RyaW5ncwogICBQdXRfTGluZSgiRGlnaXRlIGEgc3RyaW5nIEE6Iik7CiAgIEdldF9MaW5lKEEsIExlbl9BKTsKICAgUHV0X0xpbmUoIkRpZ2l0ZSBhIHN0cmluZyBCOiIpOwogICBHZXRfTGluZShCLCBMZW5fQik7CgogICAtLSBWZXJpZmljYSBzZSBCIGVzdMOhIGNvbnRpZG8gZW0gQQogICBmb3IgSSBpbiAxIC4uIExlbl9BIC0gTGVuX0IgKyAxIGxvb3AKICAgICAgaWYgQShJIC4uIEkgKyBMZW5fQiAtIDEpID0gQiB0aGVuCiAgICAgICAgIFB1dF9MaW5lKCJBIHN0cmluZyBCIGVzdMOhIGNvbnRpZGEgZW0gQSBuYSBwb3Npw6fDo286ICIgJiBJbnRlZ2VyJ0ltYWdlKEkpKTsKICAgICAgICAgRm91bmQgOj0gVHJ1ZTsKICAgICAgICAgZXhpdDsgLS0gRW5jZXJyYSBvIGxvb3AgYW8gZW5jb250cmFyCiAgICAgIGVuZCBpZjsKICAgZW5kIGxvb3A7CgogICBpZiBub3QgRm91bmQgdGhlbgogICAgICBQdXRfTGluZSgiQSBzdHJpbmcgQiBuw6NvIGVzdMOhIGNvbnRpZGEgZW0gQS4iKTsKICAgZW5kIGlmOwplbmQgUTVGOwo=