Skip to content

Instantly share code, notes, and snippets.

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 fuchao2012/2e0dea52ecc3896c3f82 to your computer and use it in GitHub Desktop.
Save fuchao2012/2e0dea52ecc3896c3f82 to your computer and use it in GitHub Desktop.
//char
var s="asdfasdfasdfasdfasdfasdfasdfasfdasdfasdfasdf";
var a=s.split('');
a.sort();
s=a.join('');
var ans=s.match(/(\w)1*/g);
ans.sort(function(a,b){return a.length >b.length})
console.log(ans[0][0]+':'+ans[0].length);
//word
//1. it's a word
//2. it's not only appear once
//3. where is it?
//4. if don't have one, just tell me
//5. what's the cost?
//can you give it to me ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment