Algorithm
Problem Name: beecrowd | 3303
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/3303
Big Word
By Abner Samuel P. Palmeira, Instituto Federal do Sul de Minas Gerais Brazil
Timelimit: 1
Recently Juquinha learned to say big words. These Brazilian Portuguese words are commonly called "palavrao"s. Amazed at the discovery of the boy, her mother forbade him to say any "palavrao", about the risk of the boy losing his allowance.
As Juquinha hates being without an allowance, he hired you to develop a program to tell him if a word is a "palavrao" or not.
"Palavrao"s are words that contain ten or more characters, all other words are considered "palavrinha"s.
Input
Input consists of several test cases. Each case contains a string that describes the word that Juquinha wants to look up. This string is made up of only lowercase letters and its length does not exceed 20 characters.
Output
For each test case, print whether the word Juquinha consulted is a "palavrao" (big word) or a "palavrinha" (other words).
Input Samples | Output Samples |
paralelepipedo |
palavrao |
carro |
palavrinha |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include <stdio.h>
#include <string.h>
int main() {
char a[20];
scanf("%s", &a);
if(strlen(a) >= 10){
printf("palavrao\n");
}else{
printf("palavrinha\n");
}
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
using namespace std;
int main() {
string palavra;
cin >> palavra;
if(palavra.length() >= 10){
cout << "palavrao\n";
}else{
cout << "palavrinha\n";
}
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Javascript Programming
Code -
Javascript Programming
const { readFileSync } = require("fs")
const [word] = readFileSync("/dev/stdin", "utf8").split("\n")
const getWordType = (str = "") => str.length >= 10 ? "palavrao" : "palavrinha"
console.log(getWordType(word))
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Javascript Programming
Code -
Javascript Programming
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
if(lines[0].length >= 10) {
console.log('palavrao')
} else {
console.log('palavrinha')
}
Copy The Code &
Try With Live Editor
Input
Output
#5 Code Example with Python Programming
Code -
Python Programming
x = input()
print("palavrao") if len(x)>=10 else print("palavrinha")
Copy The Code &
Try With Live Editor
Input
Output