This page is still under construction.

Parts of this page are still being built. What you see may change.

Parity of Strings

Interview

Time limit1sMemory limit1024 MB

Summary
Given a lowercase string, decide whether every letter appears an even number of times, every letter appears an odd number of times, or neither.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

The historical battle between numbers and strings has taken a new twist. Numbers brag about being classified as 'even' or 'odd', while strings lack such a feature. But don't count strings out yet!

A string is 'even' if every letter in it appears an even number of times. A string is 'odd' if every letter in it appears an odd number of times.

Given a string, determine whether it is even, odd, or neither.

Input

The input is a single line, starting in column 1 and not exceeding column 70. It contains only lowercase letters, and there is at least one letter.

Output

Print a single integer. Print 0 if the string is even, 1 if the string is odd, or 2 if the string is neither.

Examples3

  1. Example 1

    Input
    coachessoaehwwwwww
    
    Expected output
    0
    
  2. Example 2

    Input
    coachesarefun
    
    Expected output
    2
    
  3. Example 3

    Input
    coachesc
    
    Expected output
    1