All Tracks Algorithms String Algorithms Basics of String Manipulation Problem

Name Game
Tag(s):

Easy

Problem
Editorial
Analytics

John has recently learned about ASCII values. With his knowledge of ASCII values and character he has developed a special word and named it John's Magical word.

A word which consists of alphabets whose ASCII values is a prime number is a John's Magical word. An alphabet is john's Magical alphabet if its ASCII value is prime.

John's nature is to boast about the things he know or have learnt about. So just to defame his friends he gives few string to his friends and ask them to convert it to John's Magical word. None of his friends would like to get insulted. Help them to convert the given strings to John's Magical Word.

Rules for converting:

1.Each character should be replaced by the nearest John's Magical alphabet.

2.If the character is equidistant with 2 Magical alphabets. The one with lower ASCII value will be considered as its replacement.

Input format:

First line of input contains an integer T number of test cases. Each test case contains an integer N (denoting the length of the string) and a string S.

Output Format:

For each test case, print John's Magical Word in a new line.

Constraints:

1 <= T <= 100

1 <= |S| <= 500

SAMPLE INPUT
1
8
KINGKONG
SAMPLE OUTPUT
IIOGIOOG
Time Limit: 5.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Parul University

Challenge Name

Code-Camp

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications

?