TopCoder problem "InsideOut" used in SRM 224 (Division II Level One)



Problem Statement

    

Your printer has been infected by a virus and is printing gibberish. After staring at several printed pages for a while, you realize that it is printing every line inside-out. In other words, the left half of each line is being printed starting in the middle of the page and proceeding out toward the left margin. Similarly, the right half of each line is being printed starting at the right margin and proceeding in toward the middle of the page. For example, the line

    THIS LINE IS GIBBERISH
is being printed as
    I ENIL SIHTHSIREBBIG S
Your task is to unscramble a String line from its printed form back into its original order. You can assume that line contains an even number of characters.
 

Definition

    
Class:InsideOut
Method:unscramble
Parameters:String
Returns:String
Method signature:String unscramble(String line)
(be sure your method is public)
    
 

Constraints

-line contains between 2 and 50 characters, inclusive.
-line contains an even number of characters.
-line contains only uppercase letters ('A'-'Z') and spaces (' ').
 

Examples

0)
    
"I ENIL SIHTHSIREBBIG S"
Returns: "THIS LINE IS GIBBERISH"
The example above.
1)
    
"LEVELKAYAK"
Returns: "LEVELKAYAK"
2)
    
"H YPPAHSYADILO"
Returns: "HAPPY HOLIDAYS"
3)
    
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Returns: "MLKJIHGFEDCBAZYXWVUTSRQPON"
4)
    
"RUT OWT SNEH HCNERF EERHTEGDIRTRAP A DNA  SEVODELT"
Returns: "THREE FRENCH HENS TWO TURTLEDOVES  AND A PARTRIDGE"

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=3452

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=5870&pm=3452

Writer:

vorthys

Testers:

PabloGilberto , lbackstrom , brett1479

Problem categories:

String Manipulation