PL - Palindrome Lover


Asad is a 10 years old boy. He loves to learn new logic from computer science. Palindrome is an interesting topic to him. So, He starts practicing to finding palindrome in his everyday life.

A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. such as – madam, 0001000 etc.

He faces a problem and asks for your help. You are a great programmer in our country.Now, you have given a string S . You have to do a permutation of string S through many times (can be 0 times) such that you will get a palindromic string P . You have to check whether it is possible to form a palindrome after any permutation or not.

Input

Every line of the input contains a single string S.

Constraints:

  • S will consist only of lowercase English letters (i.e. characters 'a' through 'z').
  • 1 ≤ |S| ≤ 105

Output

For each test case, print a single line. Print 1, if it is possible to find at least one valid permutation P of string S which is a palindrome. Otherwise print -1.

Example

Input:
abc
abab

Output:
-1
1

Note:

In, Case 2: ‘baab’ is a valid permutations of string ‘abab’ which is also a palindrome. So output will be 1.


hide comments
polarisarert: 2019-11-09 17:11:08

i dont understand how the input works, always time exceeded

ayushgupta1997: 2018-07-27 09:46:39

take input till end of file :|

asad: 2018-07-11 08:09:41

The problem statement is updated. Sorry for the disturbance

anjali_7: 2018-07-07 18:50:00

i m getting runtime error in this ..what could be the reason?

kaushalag29: 2018-06-26 06:29:17

@asad_IT Update your input statement,it should be till EOF not for t testcases.

prateek_imkp1: 2018-06-24 16:15:40

Read until EOF . I got 2 wa just because I was reading t strings only .

asad: 2018-06-24 09:19:59

this is an easy problem.but there was a bug in output file.Now it is fixed. #shravinson

shravinson: 2018-06-24 09:15:12

AC in 1 go.......

mehmetin: 2018-06-24 06:04:10

Read until eof

nadstratosfer: 2018-06-24 03:04:51

There's some garbage in the testfiles. I've failed to devise an input method that wouldn't crash a Python solution, and a C program gives WA. Please sort this out.


Added by:asad_IT
Date:2018-06-23
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:String