Skip to content

pramodsabat/stringencoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

stringencoding

String encoding using a custom logic in Scala.

Custom logic -

  1. vowels are replaced with number: a -> 1, e -> 2, i -> 3, o -> 4, and u -> 5
  2. consonants are replaced with previous letter: b -> a, c -> b, d -> c, etc.
  3. y is replaced with space
  4. space is replaced with y
  5. The result should be in lower case
  6. Nmbers are replaced with their reverse: 1 -> 1, 23 -> 32, 1234 -> 4321
  7. The special characters will be as is

Example - Input - Hello World Output - g2kk4yv4qkc

Input - Have you tried turning it off and on again? Output - g1u2y 45ysq32cys5qm3mfy3sy4eey1mcy4my1f13m?

Input - The quick brown fox jumps over the lazy dog Output - sg2yp53bjyaq4vmye4wyi5lory4u2qysg2yk1y yc4f

Input - "Why haven't you finished the exercise yet?" said Nate. Output - "vg yg1u2m'sy 45ye3m3rg2cysg2y2w2qb3r2y 2s?"yr13cym1s2.

Input - You've never heard of the Millennium Falcon? It's the ship that made the Kessel Run in less than 12 parsecs. Output - 45'u2ym2u2qyg21qcy4eysg2yl3kk2mm35lye1kb4m?y3s'rysg2yrg3oysg1syl1c2ysg2yj2rr2kyq5my3myk2rrysg1my21yo1qr2br.

Input - The one from the village, FN2187 Output - sg2y4m2yeq4lysg2yu3kk1f2,yem7812

Input - He asked for a 13 but they drew a 31 Output - g2y1rj2cye4qy1y31ya5sysg2 ycq2vy1y13