Description
When a text reads the same forwards and backwards, we call it a palindrome. For example: "abba", "abcba".
當一段文字從前往後讀與從後往前讀取時相同時,我們稱之為迴文(palindrome)。例如:abba, abcba。
Some texts are not palindromes but can be rearranged to form one. For example: "aabb" can be rearranged to "abba".
而有一些文字雖然不是迴文,但在重新排列後可以組成迴文。例如:aabb 可重新排列成 abba。
Please write a program to determine if the user's input text can be rearranged to form a palindrome.
請撰寫一個程式, 判斷使用者輸入的文字能不能重新排列成迴文。
Input
Each test case consists of one line containing up to 1000 uppercase and lowercase English letters and punctuation marks.
一筆測試資料一行,包含總數不超過 1000 個的大小寫英文字母和標點符號。
Surprisingly, there are no spaces inside the input.
不可思議的是,裡面不會有任何空白字元。
Output
If it's possible to rearrange the letters to form a palindrome, output "yes !". Otherwise, output "no...".
如果重新安排順序後,有辦法讓這一堆英文字母變成迴文的話,輸出「yes !」,否則輸出「no...」。
Note that uppercase and lowercase letters are considered the same (i.e., 'A' and 'a' are equivalent), and please ignore all non-alphabetic characters.
注意,大寫和小寫字母視為相同,即 A 和 a 是一樣的,並且,請忽視所有非英文字母的字元。
Sample Input 1
ababa
bbaaa
Level
aaabbbcc
abcdefg
HowAreYouToday
A_man,_a_plan,_a_canal:_Panama.
Sample Output 1
yes !
yes !
yes !
no...
no...
no...
yes !
Sample Input 2
]234owoou-owu+123
Sample Output 2
yes !
Hint
在迴文中在有奇數個字母的時候,只有最中間的字母是單獨一個,其他都一定是兩兩一組。