Algorithm

Problem Name: beecrowd | 2850

Polyglot Parrot

By Felipe C. Ochial, URI Brazil

Timelimit: 1

Humberto has a smart parrot. When he has both legs on the ground, the parrot speaks Portuguese. When he lifts his left leg, he speaks in English. Finally, when he raises his right, he speaks French. Nico, Humberto's friend, was fascinated by the animal. In his excitement he asked, "And when he lift both of them?" Before Humberto could respond, the parrot shouted, "Oh, I'll fall, you idiot!"

Input

The input consists of several test cases. Each test case consists of a string informing the parrot's leg raising situation. “direita” means his right leg is raised, “esquerda” means his left leg is raised, “nenhuma” means none of his leg are raised and “as duas” means both his legs are raised.

Output

For each parrot's leg raising condition, print out the language he will use. For English, print “ingles”, for French print “frances” and for Portuguese print “portugues”. If he lifts both legs, print "caiu." Break a line for each test case.

 Input Sample Output Sample esquerda direita nenhuma as duas ingles frances portugues caiu

Code Examples

#1 Code Example with C Programming

```Code - C Programming```

``````
#include <stdio.h>
#include <string.h>

int main ()
{

char pergunta[10];

while (scanf(" %[^\n]", pergunta) != EOF)
{

if (strcmp(pergunta, "esquerda") == 0)
printf("ingles\n");
else if (strcmp(pergunta, "direita") == 0)
printf("frances\n");
else if (strcmp(pergunta, "nenhuma") == 0)
printf("portugues\n");
else if (strcmp(pergunta, "as duas") == 0)
printf("caiu\n");

}

}
``````
Copy The Code &

Input

cmd
esquerda direita nenhuma as duas

Output

cmd
ingles frances portugues caiu

#2 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <iostream>
#include <string>

using namespace std;

int main()
{
string s;
while (getline(cin, s))
{
if (s=="direita")
cout << "frances" << endl;
else if (s=="esquerda")
cout << "ingles" << endl;
else if (s=="nenhuma")
cout << "portugues" << endl;
else if (s=="as duas")
cout << "caiu" << endl;
fflush(stdin);
}
return 0;
}

``````
Copy The Code &

Input

cmd
esquerda direita nenhuma as duas

Output

cmd
ingles frances portugues caiu

#3 Code Example with Javascript Programming

```Code - Javascript Programming```

``````
const { readFileSync } = require("fs")
const input = readFileSync("/dev/stdin", "utf8").split("\n")

const ParrotLegsStateEnum = {
"esquerda": "ingles",
"direita": "frances",
"nenhuma": "portugues",
"as duas": "caiu"
}

const output = []

while (input.length > 0) {
const state = input.shift()
if (state == "") break // EOFile Condition

output.push(ParrotLegsStateEnum[state])
}

console.log(output.join("\n"))
``````
Copy The Code &

Input

cmd
esquerda direita nenhuma as duas

Output

cmd
ingles frances portugues caiu

#4 Code Example with Python Programming

```Code - Python Programming```

``````
while True:
try:
c = input()
if c == 'esquerda':
print('ingles')
elif c == 'direita':
print('frances')
elif c == 'nenhuma':
print('portugues')
elif c == 'as duas':
print('caiu')

except EOFError:
break

``````
Copy The Code &

Input

cmd
esquerda direita nenhuma as duas

Output

cmd
ingles frances portugues caiu