2022-04-24 20:59:53 +02:00
|
|
|
from typing import TypeVar
|
2022-04-23 21:48:12 +02:00
|
|
|
import sys
|
|
|
|
|
2022-04-24 20:59:53 +02:00
|
|
|
T = TypeVar('T')
|
|
|
|
|
2022-04-24 20:27:51 +02:00
|
|
|
input_values: list[str] = []
|
2022-04-23 21:48:12 +02:00
|
|
|
for value in sys.stdin:
|
|
|
|
input_values.append(value.rstrip('\n'))
|
|
|
|
|
|
|
|
|
2022-04-24 20:59:53 +02:00
|
|
|
def get_is_valid_subsequence(array: list[T], sequence: list[T]) -> bool:
|
2022-04-23 21:48:12 +02:00
|
|
|
index_to_check = 0
|
|
|
|
for index in range(len(array)):
|
|
|
|
if index_to_check < len(sequence) and array[index] == sequence[index_to_check]:
|
|
|
|
index_to_check += 1
|
|
|
|
return index_to_check == len(sequence)
|
|
|
|
|
|
|
|
|
|
|
|
is_valid_subsequence = get_is_valid_subsequence(
|
|
|
|
input_values[0].split(' '), input_values[1].split(' '))
|
|
|
|
print('true' if is_valid_subsequence else 'false')
|