diff --git a/.gitignore b/.gitignore
index <HASH>..<HASH> 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ spec/reports
 test/tmp
 test/version_tmp
 tmp
+.idea/
diff --git a/lib/words_counted/counter.rb b/lib/words_counted/counter.rb
index <HASH>..<HASH> 100644
--- a/lib/words_counted/counter.rb
+++ b/lib/words_counted/counter.rb
@@ -62,7 +62,7 @@ module WordsCounted
   private
 
     def highest_ranking(entries)
-      entries.group_by { |_, value| value }.sort.last.last
+      entries.empty? ? [] : entries.group_by { |_, value| value }.sort.last.last
     end
 
     def sort_by_descending_value(entries)
diff --git a/spec/words_counted/counter_spec.rb b/spec/words_counted/counter_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/words_counted/counter_spec.rb
+++ b/spec/words_counted/counter_spec.rb
@@ -134,6 +134,11 @@ module WordsCounted
         counter = Counter.new("Orange orange Apple apple banana")
         expect(counter.most_occurring_words).to eq([["orange", 2],["apple", 2]])
       end
+
+      it "returns empty array when input is empty string" do
+        counter = Counter.new("")
+        expect(counter.most_occurring_words).to eq([])
+      end
     end
 
     describe 'word_lengths' do
Added check to see if entries are empty in highest_ranking. Test case also written.