×

Practice

Contest

CAKEWALK.

Strings, Arrays.

# PROBLEM:

Given a string s with n characters, we need to perform the following steps:

• swap every alphabet with its ASCII reverse alphabet. Ex: For 'a' the reverse ASCII value is 'z'. we can do this by ASCII values (char)(122-'a'+97) = 'z'.

# EXPLANATION:

As it is very easy question, the code snippet will guide you. for(int i=0; i<len; i = i+2){ temp = en[i+1]; en[i+1]=en[i]; en[i]=temp; }

# AUTHOR'S AND TESTER'S SOLUTIONS:

Author's solution can be found here.

This question is marked "community wiki".

1
accept rate: 0%

19.8k350498541

 0 Nice chance to use a dictionary in Python. alph = 'abcdefghijklmnopqrstuvwxyz' cbk = dict() for ch in range(26): cbk[alph[ch]] = alph[25-ch] PS: the puzzle code for the practice version is ENCMSG (for searchers). answered 05 Aug '18, 07:28 5★joffan 948●8 accept rate: 13%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×847
×349

question asked: 04 Aug '18, 20:42

question was seen: 107 times

last updated: 06 Aug '18, 17:55