using System;
using System.Linq;
static class Program
{
static string[]
SplitBySpace(string s)
{
return s.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
}
static bool
Presence(string[] data, string[] buff)
{
if( buff.Length == 0 ) { return true; }
int idx = Array.IndexOf(data, buff[0]);
if( idx == -1 ) { return false; }
return Presence(data.Skip(idx).ToArray(), buff.Skip(1).ToArray());
}
static void
TestPresence(string data, string buff)
{
if( Presence(SplitBySpace(data), SplitBySpace(buff)) ) {
Console.WriteLine("{0} contains {1}.", data, buff);
} else {
Console.WriteLine("{0} does not contain {1}.", data, buff);
}
}
static void Main(string[] args)
{
TestPresence("6 13 24 31 35", "6 1");
TestPresence("6 13 24 31 35", "6 13");
}
}