[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
借 3 楼代码一用
  1. @if (0)==(0) echo off
  2. cscript //nologo //e:jscript "%~f0" < %0 & pause & exit
  3. @end
  4. var s = WScript.StdIn.ReadAll();
  5. s = s.match(/[^\r\n]/g).sort().join('');
  6. var re = /(.)(\1)*/g, n = 0, ar = [];
  7. s.replace(re,function($0,$1){
  8. n++;
  9. ar.length = ar.length > $0.length ? ar.length : $0.length;
  10. ar[$0.length-1] ? ar[$0.length-1].push($1) : ar[$0.length-1]=[$1];
  11. })
  12. WScript.Echo('最多: ' + ar.pop().join('\r\n') + '\n个数: ' + n);
复制代码

TOP

本帖最后由 CrLf 于 2015-10-21 20:49 编辑

回复 6# 依山居


powershell:
  1. $s = 'A Counter is a dict subclass for counting hashable objects. It is an unordered collection where elements are stored as dictionary keys and their counts are stored as dictionary values. Counts are allowed to be any integer value including zero or negative counts. The Counter class is similar to bags or multisets in other languages.'
  2. [char[]]$s | group-object | sort-object -desc count|select-object -first 5
复制代码
极限压缩后的代码长度和你差不多:
  1. ([char[]]$s|group|sort *)[-1..-5]
复制代码

TOP

回复 9# 依山居


    done

TOP

回复 11# 依山居


    所以把技能点用光了

TOP

返回列表