GlobeX Cup '19 J5 - Aliens

View as PDF

Submit solution

Points: 15
Time limit: 0.6s
Python 1.8s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Scientists are constantly listening for aliens. Because of the great distances, some things may come more delayed than others. Thus they need an algorithm that when given two strings, a, and b (2 \leq |a|, |b| \leq 1000, where |a| = |b|), determines whether it is possible to make b by taking a single substring of a and moving it to another index. It should also detect aliens when the two strings are the same.

Note: The constraints and data have changed from the contest problem.

Input Specification

The input will consist of two newline separated strings, a and b. Each string will only consist of lowercase letters.

Output Specification

Output aliens if it is possible, else no aliens.

Sample Input 1


Sample Output 1


Explanation for Sample 1

The substring f was moved to after index 3 (starting with 1).

Sample Input 2


Sample Output 2

no aliens

Explanation for Sample 2

There is no single substring that can be moved to create the new string.


There are no comments at the moment.