PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000146. Hoán vị chuỗi tại chỉ số nguyên tố (Prime Permutation)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Hoán vị chuỗi tại chỉ số nguyên tố (Prime Permutation)

Prime Permutation

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Permute the lowercase letters of ss so that for every prime p≤∣s∣p\le|s| and every 1≤i≤⌊∣s∣/p⌋1\le i\le \lfloor |s|/p\rfloor, positions pp and pipi contain equal characters. Print YES and a permutation, otherwise NO.

Input

One line containing string ss.

Output

Print YES and the rearranged string, or NO.

Subtask

  • Subtask 1 (20 points): 1≤∣s∣≤301\le |s|\le30.
  • Subtask 2 (30 points): 1≤∣s∣≤1501\le |s|\le150.
  • Subtask 3 (50 points): 1≤∣s∣≤10001\le |s|\le1000.

Example

Input

xxxyxxx

Output

YES
xxxxxxy

Explanation

The prime positions 2 and 3 and their multiples 4 and 6 all have the letter x. Reordering preserves the input character counts.