Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created March 21, 2018 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/a6e9dd7485258a62cde679cfc3f67d03 to your computer and use it in GitHub Desktop.
Save whatalnk/a6e9dd7485258a62cde679cfc3f67d03 to your computer and use it in GitHub Desktop.
CODE THANKS FESTIVAL 2017(Parallel) B. Concatenated Palindrome
s = gets.chomp
ss = s.reverse
ans = ss.length
ss.length.times do |i|
sss = s + ss[i..-1]
if sss == sss.reverse then
ans = ss.length - i
end
end
if s == ss then
puts 0
else
puts ans
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment