回文

左から右へ、また右から左へ読んでも同じになる文字列を「回文」と呼びます(例: radar、madam、racecar)。

文字列 s が与えられたとき、文字を削除して s から回文を作ることができる異なる方法の数を求めます。文字をまったく削除しなくても回文が得られる場合があります。なお、削除の順番は考慮しません。

入力

入力として、長さ |s| が 1 以上 60 以下の大文字のラテン文字のみからなる文字列 s が与えられます。

出力

文字列 s から回文を得るための異なる方法の数を出力してください。

Input

Output

BAOBAB

22

解説

  1. BAOBAB

  2. BAOBAB

  3. BAOBAB

  4. BAOBAB

  5. BAOBAB

  6. BAOBAB

  7. BAOBAB

  8. BAOBAB

  9. BAOBAB

  10. BAOBAB

  11. BAOBAB

  12. BAOBAB

  13. BAOBAB

  14. BAOBAB

  15. BAOBAB

  16. BAOBAB

  17. BAOBAB

  18. BAOBAB

  19. BAOBAB

  20. BAOBAB

  21. BAOBAB

  22. BAOBAB

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue