We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78171c3 commit 15329fcCopy full SHA for 15329fc
Codeforces/Div II/278B_170.rb
@@ -0,0 +1,25 @@
1
+n = gets.to_i;
2
+a = (0..n-1).inject([]) {|acc, y|
3
+ s = gets.chomp
4
+ b = (0..s.length-1).inject([]){ |ai, x|
5
+ (x..s.length-1).inject(ai){ |aj, y|
6
+ aj << s[x..y]
7
+ }
8
9
+ acc + b
10
+}.sort{ |x, y|
11
+ if x.size < y.size
12
+ -1
13
+ elsif x.size > y.size
14
+ 1
15
+ else
16
+ if x <= y then -1 else 1 end
17
+ end
18
+}.uniq
19
+ans="a"
20
+a.each{|x|
21
+ break if x != ans
22
+ ans.succ!
23
+}
24
+puts ans
25
+
0 commit comments