using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IEnumなんとかてすと
{
class Program
{
static void Main(string[] args)
{
int[] A = new int[16] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
foreach (var o in A.SkipEnd())
{
Console.Write("{0} ", o);
}
return;
}
}
public static class ExtFunc
{
public static IEnumerable<T> SkipEnd<T>(this IEnumerable<T> Enumerable)
{
var En = Enumerable.GetEnumerator();
int N = Enumerable.Count();
int i = 0;
while (En.MoveNext())
{
i++;
if (N == i) break;
yield return En.Current;
}
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkxpbnE7CnVzaW5nIFN5c3RlbS5UZXh0OwoKbmFtZXNwYWNlIElFbnVt44Gq44KT44Go44GL44Gm44GZ44GoCnsKICAgIGNsYXNzIFByb2dyYW0KICAgIHsKICAgICAgICBzdGF0aWMgdm9pZCBNYWluKHN0cmluZ1tdIGFyZ3MpCiAgICAgICAgewogICAgICAgICAgICBpbnRbXSBBID0gbmV3IGludFsxNl0geyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5LCAxMCwgMTEsIDEyLCAxMywgMTQsIDE1IH07CgogICAgICAgICAgICBmb3JlYWNoICh2YXIgbyBpbiBBLlNraXBFbmQoKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiezB9ICIsIG8pOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm47CiAKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIHN0YXRpYyBjbGFzcyBFeHRGdW5jCiAgICB7CiAgICAgICAgcHVibGljIHN0YXRpYyBJRW51bWVyYWJsZTxUPiBTa2lwRW5kPFQ+KHRoaXMgSUVudW1lcmFibGU8VD4gRW51bWVyYWJsZSkKICAgICAgICB7CiAgICAgICAgICAgIHZhciBFbiA9IEVudW1lcmFibGUuR2V0RW51bWVyYXRvcigpOwogICAgICAgICAgICBpbnQgTiA9IEVudW1lcmFibGUuQ291bnQoKTsKICAgICAgICAgICAgaW50IGkgPSAwOwogICAgICAgICAgICB3aGlsZSAoRW4uTW92ZU5leHQoKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaSsrOwogICAgICAgICAgICAgICAgaWYgKE4gPT0gaSkgYnJlYWs7CiAgICAgICAgICAgICAgICB5aWVsZCByZXR1cm4gRW4uQ3VycmVudDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQ==