#K46722. Taco Passcode Generator
Taco Passcode Generator
Taco Passcode Generator
You are given a list of non-negative integers. Your task is to generate a passcode by converting each integer according to the following rules:
- If an integer is divisible by both 2 and 3 (i.e. if \(n \bmod 6 = 0\)), replace it with
FooBar
. - If an integer is divisible by 2 (i.e. if \(n \bmod 2 = 0\)) but not by 6, replace it with
Foo
. - If an integer is divisible by 3 (i.e. if \(n \bmod 3 = 0\)) but not by 6, replace it with
Bar
. - If none of the above conditions apply, leave the integer unchanged.
The passcode is the concatenation of the replaced values in the same order as the input list.
Example:
Input: 1 2 3 4 5 6 Output: 1FooBarFoo5FooBar
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains an integer \(n\) representing the number of elements in the list.
- The second line contains \(n\) space-separated non-negative integers.
If \(n = 0\), the second line will be empty and the output should be an empty string.
outputFormat
Output to stdout a single line containing the generated passcode string based on the conversion rules described above.
## sample6
1 2 3 4 5 6
1FooBarFoo5FooBar