Algorithm
Problem Name: beecrowd | 2160
Name at Form
By M.C. Pinto, UNILA Brazil
Filling forms is a simple task. But it is necessary to check if the reserved space for data is large enough.
Your task is, given a text line, to indicate if it fits in an 80 characters length form.
Input
Input is a text line L (1 ≤ |L| ≤ 500).
Output
The output is given in a single line. It must be "YES" (without quotes) if the text line L is up to 80 characters long. If L has more than 80 characters, the output must be "NO".
Input Samples | Output Samples |
Fulano de Tal |
YES |
Pedro de Alcantara Francisco Antonio Joao Carlos Xavier de Paula Miguel Rafael Joaquim Jose Gonzaga Pascoal Cipriano Serafim |
NO |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(){
char texto[500];
scanf("%[^\n\r]", texto);
if(strlen(texto) < 81)
printf("YES\n");
else
printf("NO\n">;
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
getline(cin , s);
int l = s.length();
if(l <= 80> cout << "YES\n";
else cout << "NO\n";
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Javascript Programming
Code -
Javascript Programming
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var prompt = function(texto) { return lines.shift();};
if (prompt().length > 80) {
console.log("NO");
} else {
console.log("YES");
}
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Python Programming
Code -
Python Programming
t = str(input())
n = len(t)
if n <= 80: print('YES')
else: print('NO')
Copy The Code &
Try With Live Editor
Input
Output