diff --git a/lib/commands/submit.js b/lib/commands/submit.js
index <HASH>..<HASH> 100644
--- a/lib/commands/submit.js
+++ b/lib/commands/submit.js
@@ -16,7 +16,10 @@ var cmd = {
 var INDENT = '    ';
 
 cmd.handler = function(argv) {
-  var keyword = h.getFilename(argv.filename);
+  // use the 1st section in filename as keyword
+  // e.g. two-sum.cpp, or two-sum.78502271.ac.cpp
+  var keyword = h.getFilename(argv.filename).split('.')[0];
+
   core.getProblem(keyword, function(e, problem) {
     if (e) return log.fail(e);
 
diff --git a/lib/commands/test.js b/lib/commands/test.js
index <HASH>..<HASH> 100644
--- a/lib/commands/test.js
+++ b/lib/commands/test.js
@@ -55,7 +55,10 @@ cmd.handler = function(argv) {
     testcase = h.readStdin();
   }
 
-  var keyword = h.getFilename(argv.filename);
+  // use the 1st section in filename as keyword
+  // e.g. two-sum.cpp, or two-sum.78502271.ac.cpp
+  var keyword = h.getFilename(argv.filename).split('.')[0];
+
   core.getProblem(keyword, function(e, problem) {
     if (e) return log.fail(e);
Support test/submit with complex filename.