// PascalABC.NET 3.2, сборка 1353 от 27.11.2016 // Внимание! Если программа не работает, обновите версию!
function MaxSubstr(s1,s2:string):string; begin var a:=new integer[s1.Length+1,s2.Length+1]; var u:=0; var v:=0; for var i:=0 to s1.Length-1 do for var j:=0 to s2.Length-1 do if s1[i+1]=s2[j+1] then begin a[i+1,j+1]:=a[i,j]+1; if a[i+1,j+1]>a[u,v] then begin u:=i+1; v:=j+1 end end; Result:=s1.Substring(u-a[u,v],a[u,v]) end;
begin var s:='trapperkaperkatrter'; var t:='appekaperspamer'; Writeln(MaxSubstr(s,t)) end.
Python
1.
import random
X = int(input())
N_spisok = []
N = 20
for i in range(0, N):
N_random = random.randint(0, N)
N_spisok.append(N_random)
print(N_spisok)
for i in N_spisok:
if i == X:
print(i)
else:
break
2.
time = int(input())
zima = [12, 1, 2]
vesna = [3, 4, 5]
leto = [6, 7, 8]
osen = [9, 10, 11]
if time in zima:
print('Зима')
elif time in vesna:
print('Весна')
elif time in leto:
print('Лето')
else:
print('Осень')
3.
a = [1, 2, 3, 4, 5, 8, 11, 13, 14, 16, 17]
a.remove(8)
a.append(22)
print(a)
// Внимание! Если программа не работает, обновите версию!
function MaxSubstr(s1,s2:string):string;
begin
var a:=new integer[s1.Length+1,s2.Length+1];
var u:=0; var v:=0;
for var i:=0 to s1.Length-1 do
for var j:=0 to s2.Length-1 do
if s1[i+1]=s2[j+1] then begin
a[i+1,j+1]:=a[i,j]+1;
if a[i+1,j+1]>a[u,v] then begin u:=i+1; v:=j+1 end
end;
Result:=s1.Substring(u-a[u,v],a[u,v])
end;
begin
var s:='trapperkaperkatrter';
var t:='appekaperspamer';
Writeln(MaxSubstr(s,t))
end.