#SP0000014. Từ nguyên tố (Prime Words)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Từ nguyên tố (Prime Words)
Prime Words
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A word contains only English lowercase a–z and uppercase A–Z letters. Assign lowercase letters values through (a is , ..., z is ) and uppercase letters values through (A is , ..., Z is ). The value of a word is the sum of its letter values. It is a prime word if this sum is prime under the original UVa problem convention, which exceptionally counts as prime as well as the usual prime numbers. Determine whether the input is a prime word.
Input
One line containing the word , consisting only of uppercase and lowercase English letters. Its length is .
Output
Print exactly It is a prime word. if the word is prime, and It is not a prime word. otherwise. Preserve the final period.
Subtasks
- Subtask 1 (20 points): ; each character is in
a–zorA–Z. - Subtask 2 (30 points): ; each character is in
a–zorA–Z. - Subtask 3 (50 points): ; each character is in
a–zorA–Z.
Examples
Input
UFRN
Output
It is a prime word.
Explanation
The letters have values U , F , R , N . Their sum is , which is prime, so print It is a prime word..
Input
contest
Output
It is not a prime word.
Explanation
The letters of contest are worth , totaling . Since is composite, the word is not prime.
Input
a
Output
It is a prime word.
Explanation
The letter a has value . By the special convention of UVa 10924, counts as prime, so the word is prime.