/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static boolean contains(int[] a, int[] b) {
int i=0,j=0;
while(i<a.length && j<b.length){
if(a[i]==b[j])
j++;
i++;
}
return j==b.length;
}
{
System.
out.
println(contains
(new int[]{1,
2,
3,
4,
2,
1,
3,
4},
new int[]{2,
3,
4})); System.
out.
println(contains
(new int[]{1,
2,
3,
4,
2,
1,
3,
4},
new int[]{1,
4,
3})); System.
out.
println(contains
(new int[]{1,
2,
3,
4,
2,
1,
3,
4},
new int[]{3,
3,
2})); System.
out.
println(contains
(new int[]{1,
2,
3,
4,
2,
1,
3,
4},
new int[]{1,
1,
2})); System.
out.
println(contains
(new int[]{1,
2,
3,
4,
2,
1,
3,
4},
new int[]{})); System.
out.
println(contains
(new int[]{},
new int[]{1,
2,
3})); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjb250YWlucyhpbnRbXSBhLCBpbnRbXSBiKSB7CgkgIGludCBpPTAsaj0wOwoJICB3aGlsZShpPGEubGVuZ3RoICYmIGo8Yi5sZW5ndGgpewoJICAgIGlmKGFbaV09PWJbal0pCgkgICAgICBqKys7CgkgICAgaSsrOwoJICB9CgkgIHJldHVybiBqPT1iLmxlbmd0aDsKCX0KCQoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJU3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