[Question]
  [
Given a palindrome generated according to [this challenge](https://codegolf.stackexchange.com/questions/98325/palindromize-this-string), depalindromize it.
### Test cases
```
abcdedcba -> abcde
johncenanecnhoj -> johncena
ppapapp -> ppap
codegolflogedoc -> codegolf
```
As this is about depalindromizing, **your code cannot be a palindrome**.
Remember, this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the code with the fewest bytes wins.
  
[Answer]
# Julia, ~~21~~ 15 bytes
```
x->x[1:end/2+1]
```
[Try it online!](http://julia.tryitonline.net/#code=cHJpbnQoKHgtPnhbMTplbmQvMisxXSkoImFiY2RlZGNiYSIpKQ&input=) (extra code is for printing output)
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 3 bytes
```
2ä¬
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=MsOkwqw&input=YWJjZGVkY2Jh)
[Answer]
# Python 2, 23 bytes
I am not able to test on my phone, but this should work:
```
lambda s:s[:-~len(s)/2]
```
[Answer]
# Fuzzy Octo Guacamole, 4 bytes
```
2.^/
```
I spent a while searching for a language in which this challenge is short, and realized I was dumb and my own language did that.
[Answer]
# 05AB1E, 5 bytes
```
Dg;î£
```
[Try it online!](http://05ab1e.tryitonline.net/#code=RGc7w67Cow&input=am9obmNlbmFuZWNuaG9q)
**Explanation:**
```
D      Duplicate
 g;î   Divide length by two and round up
    £  First b letters of a
```
[Answer]
# Cheddar, ~~22~~ 18 bytes
```
@.head($0.len/2+1)
```
So simple I don't think needs explanation but I'll add one if wanted.
[Try it online](http://cheddar.tryitonline.net/#code=bGV0IGY9IEAuaGVhZCgkMC5sZW4vMisxKTsKCnByaW50IGYoImpvaG5jZW5hbmVjbmhvaiIpOw&input=)
[Answer]
# Pyth - 4 bytes
```
hc2Q
```
[Test Suite](http://pyth.herokuapp.com/?code=hc2Q&test_suite=1&test_suite_input=%22abcdedcba%22%0A%22johncenanecnhoj%22%0A%22ppapapp%22%0A%22codegolflogedoc%22&debug=0).
[Answer]
# JavaScript (ES6), ~~32 26~~ 25 bytes
1 byte saved thanks to Neil:
```
s=>s.slice(0,-s.length/2)
```
```
f=
  s=>s.slice(0,-s.length/2)
;
console.log(f('abcdedcba'))
console.log(f('johncenanecnhoj'))
console.log(f('ppapapp'))
console.log(f('codegolflogedoc'))
```
---
**Previous solutions**  
26 bytes thanks to Downgoat:
```
s=>s.slice(0,s.length/2+1)
```
32 bytes:
```
s=>s.slice(0,(l=s.length/2)+l%2)
```
[Answer]
# WinDbg, ~~87~~ 71 bytes
```
db$t0 L1;.for(r$t1=@$t0;@$p;r$t1=@$t1+1){db$t1 L1};da$t0 L(@$t1-@$t0)/2
```
*-16 bytes by not inserting NULL, instead passing length to `da`*
Input is passed in via an address in psuedo-register `$t0`. For example:
```
eza 2000000 "abcdedcba"       * Write string "abcdedcba" into memory at 0x02000000
r $t0 = 33554432              * Set $t0 = 0x02000000
* Edit: Something got messed up in my WinDB session, of course r $t0 = 2000000 should work
* not that crazy 33554432.
```
It works by replacing the right of middle char (or right-middle if the string has even length) with a null and then prints the string from the original starting memory address.
```
db $t0 L1;                                   * Set $p = memory-at($t0)
.for (r $t1 = @$t0; @$p; r $t1 = @$t1 + 1)   * Set $t1 = $t0 and increment until $p == 0
{
    db $t1 L1                                * Set $p = memory-at($t1)
};
da $t0 L(@$t1-@$t0)/2                        * Print half the string
```
Output:
```
0:000> eza 2000000 "abcdeedcba"
0:000> r $t0 = 33554432
0:000> db$t0 L1;.for(r$t1=@$t0;@$p;r$t1=@$t1+1){db$t1 L1};da$t0 L(@$t1-@$t0)/2
02000000  61                                               a
02000000  61                                               a
02000001  62                                               b
02000002  63                                               c
02000003  64                                               d
02000004  65                                               e
02000005  65                                               e
02000006  64                                               d
02000007  63                                               c
02000008  62                                               b
02000009  61                                               a
0200000a  00                                               .
02000000  "abcde"
```
[Answer]
## Haskell, 27 bytes
```
take=<<succ.(`div`2).length
```
Pointfree version of
```
\x->take(div(length x)2+1)x
```
which is also 27 bytes.
[Answer]
# [MATL](http://github.com/lmendo/MATL), ~~7~~ 6 bytes
```
9LQ2/)
```
[Try it online!](http://matl.tryitonline.net/#code=OUxRMi8p&input=J2NvZGVnb2xmbG9nZWRvYyc)
### Explanation
```
9L       % Push array [1, 1j]
  Q      % Add 1: transforms into [2, 1+1j]
   2/    % Divide by 2: transforms into [1, 0.5+0.5j]
     )   % Apply as index into implicit input. The array [1, 0.5+0.5j] used as an index
         % is interpreted as [1:0.5+end*0.5]
```
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 4 bytes
```
œs2Ḣ
```
[Try it online!](http://jelly.tryitonline.net/#code=xZNzMuG4og&input=&args=J2FiY2RlZGJjYSc)
### Explanation
```
œs2      Split input into 2 chunks of similar lengths. For odd-length input,
         the first chunk is the longest
   Ḣ     Keep the first chunk
```
[Answer]
# [V](http://github.com/DJMcMayhem/V), 12 bytes
Two *completely* different solutions, both 12 bytes. 
```
ò"Bx$xh|ò"bP
```
[Try it online!](http://v.tryitonline.net/#code=w7IiQngkeGh8w7IiYlA&input=YWJjZGVkY2Jh)
```
Ó./&ò
MjdGÍî
```
[Try it online!](http://v.tryitonline.net/#code=w5MuLybDsgpNamRHw43Drg&input=YWJjZGVkY2Jh)
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), 4 bytes
```
@2tr
```
[Try it online!](http://brachylog.tryitonline.net/#code=QDJ0cg&input=InBwYXBhcHAi&args=Wg)
### Explanation
```
@2        Split in half
  t       Take the second half
   r      Reverse it
```
If the input has odd length, the second half generated by `@2` is the one that is the longest, that is the one we should return (after reversing it).
[Answer]
# [Dyalog APL](http://goo.gl/9KrKoM), 9 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319)
```
⊢↑⍨2÷⍨1+≢
```
`⊢` the argument
`↑⍨` truncated at
`2÷⍨` half of
`1+` one plus
`≢` the length
[TryAPL online!](http://tryapl.org/?a=f%u2190%u22A2%u2191%u23682%F7%u23681+%u2262%20%u22C4%20f%A8%27abcdedcba%27%20%27johncenanecnhoj%27%20%27ppapapp%27%20%27codegolflogedoc%27&run)
[Answer]
# Perl, 15 bytes
Includes +2 for `-lp`
Give input string on STDIN:
```
depal.pl <<< "HelleH"
```
`depal.pl`:
```
#!/usr/bin/perl -lp
s/../chop/reg
```
The `-l` is not really needed if you input the palindrome without final newline, but I included it to be fair to the other perl solutions that use it.
[Answer]
# Java 7, 57 bytes
```
String c(String s){return s.substring(0,s.length()/2+1);}
```
[Answer]
# TI-Basic, 14 bytes
Standard function. Returns string from index 1 to index (length/2 + 1/2).
```
sub(Ans,1,.5+.5length(Ans
```
[Answer]
# GameMaker Language, 59 bytes
```
a=argument0 return string_copy(a,1,ceil(string_length(a)/2)
```
[Answer]
# PHP, 40 bytes
```
<?=substr($a=$argv[1],0,1+strlen($a)/2);
```
`strlen($a)/2` gets cast to int, with the input always having odd length, `+1` suffices to round up.
**42 bytes** for any length:
```
<?=substr($a=$argv[1],0,(1+strlen($a))/2);
```
for unknown length, `(1+strlen)/2` gets cast to int, rounding up `strlen/2`.
[Answer]
# Dip, 8 bytes
```
H{C'0ÏEI
```
Explanation:
```
           # Implicit input
 H         # Push length of input
  {        # Add 1
   C       # Divide by 2
    '      # Convert to int
     0Ï    # Get string back
       E   # Push prefixes of string
        I  # Push prefixes[a]
           # Implicit print
```
This could probably be much improved.
[Answer]
# Perl, 23 + 2 (`-pl` flag) = ~~28~~ 25 bytes
```
perl -ple '$_=substr$_,0,1+y///c/2'
```
Ungolfed:
```
while (<>) {             # -p flag
    chomp($_)            # -l flag
    $_ = substr($_, 0, 1 + length($_) / 2);
    print($_, "\n")      # -pl flag
}
```
Thanx to @ardnew.
[Answer]
# [Befunge](http://github.com/catseye/Befunge-93), ~~24~~ 22 bytes
```
~:0`!#v_\1+
0:-2,\_@#`
```
[Try it online!](http://befunge.tryitonline.net/#code=fjowYCEjdl9cMSsKMDotMixcX0AjYA&input=Y29kZWdvbGZsb2dlZG9j)
---
Befunge has no string or array type so the everything is done on the stack one character at a time. The first loop (on the top line) counts the number of characters read (swapping with less than 2 elements in the stack produces an initial 0). The second (on the middle line) prints characters while counting down twice as fast. As a result only the last half of the input is printed, but LIFO so it's in the correct order.
Thanks to [Brian Gradin](https://codegolf.stackexchange.com/users/61606/brian-gradin) for a better version of the first loop.
[Answer]
# Perl, 14 + 3 (`-lF` flag) = ~~19~~ 17 bytes
For 5.20.0+:
```
perl -lF -E 'say@F[0..@F/2]'
```
For 5.10.0+ (19 bytes):
```
perl -nlaF -E 'say@F[0..@F/2]'
```
Ungolfed:
```
while (<>) {             # -n flag (implicitly sets by -F in 5.20.0+)
    chomp($_)            # -l flag
    @F = split('', $_);  # -aF flag (implicitly sets by -F in 5.20.0+)
    say(@F[0 .. (scalar(@F) / 2)]);
}
```
Thanx to @simbabque.
[Answer]
## Brainfuck, 20 bytes
```
,
[
  [>,]
  <[<]
  >.,>[>]
  <<
]
```
[Try it online.](http://brainfuck.tryitonline.net/#code=LFtbPixdPFs8XT4uLD5bPl08PF0&input=YWJjZGVkY2JhCg)
This saves a byte over the more straightforward approach of consuming the input before starting the main loop:
```
,[>,]
<
[
  [<]
  >.,>[>]
  <,<
]
```
[Answer]
# [Pyth](https://pyth.readthedocs.io/en/latest/getting-started.html), ~~8~~ 7 bytes
```
<zh/lz2
```
Saved 1 with thanks to @Steven H
Not the shortest Pyth answer (by half) but I'm making an effort to learn the language and this is my first post using it. Posted as much for comments and feedback as anything. It's also the first Pyth program that I have actually got to work :)
Now I just need to work out how the 4 byte answer from @Maltysen works :-)
[Answer]
# [Actually](http://github.com/Mego/Seriously), 5 bytes
```
l½KßH
```
[Try it online!](http://actually.tryitonline.net/#code=bMK9S8OfSA&input=ImpvaG5jZW5hbmVjbmhvaiI)
*-1 byte thanks to Sherlock9*
Explanation:
```
l½K@H
l½K    ceil(len(input)/2)
   ßH  first (len(input)//2 + 1) characters of input
```
[Answer]
# C, ~~31~~ 30 bytes
Saving 1 byte thanks to Cyoce.
```
f(char*c){c[-~strlen(c)/2]=0;}
```
Usage:
```
main(){
 char a[]="hellolleh";
 f(a);
 printf("%s\n",a);
}
```
[Answer]
# Python 2, 23 bytes
```
lambda x:x[:len(x)/2+1]
```
[Answer]
# MATLAB / Octave, ~~20~~ ~~19~~ ~~18~~ 16 bytes
*1 byte off borrowing an idea from [Easterly Irk's answer](https://codegolf.stackexchange.com/a/98349/36398) (add `1` instead of `.5`)*  
*2 bytes off thanks to @StewieGriffin (unnecessary parentheses)*
```
@(x)x(1:end/2+1)
```
[Try it at Ideone](http://ideone.com/c4otjN).
]