import java.util.*

fun verticalWriting(txt:String, offset:Int) =
txt.mapIndexed { i, c -> Pair(i, c) }
.groupByTo(TreeMap(), { it.first % offset }, { it.second.toString() })
.forEach { println(it.value.reversed().joinToString("|")) } fun main(args: Array<String>) =
verticalWriting("床前明月光疑是地上霜举头望明月低头思故乡", 5) /*
低|举|疑|床
头|头|是|前
思|望|地|明
故|明|上|月
乡|月|霜|光
*/

最新文章

  1. BZOJ 3158: 千钧一发
  2. javascript设计模式与开发实践
  3. C++学习笔记28:运行期型式信息
  4. php 使用 极光推送 类
  5. hdu3033 背包变形
  6. oracle之压缩表
  7. Struts2+hibernate3+Spring2的整合方法
  8. Mac系统Finder访问资源库文件夹
  9. C# 线程--第四线程实例
  10. [swustoj 679] Secret Code
  11. poj1980
  12. python之爬虫
  13. Django应用部署 - 上线指南
  14. tomcat8 性能优化
  15. 收藏:Non-direct与direct ByteBuffer区别
  16. Men and women can&#39;t be &#39;just friends
  17. python 进行机器学习
  18. 还没有写完准备弡上cpickle 还有字典
  19. elasticsearch之JAVA环境变量报错:could not find java; set JAVA_HOME or ensure java is in PATH
  20. 【JQuery】事件冒泡及使用jQuery阻止

热门文章

  1. Spring+MyBatis实现数据库读写分离方案
  2. SCCM2012 R2实战系列之四:初始化配置
  3. 在线学习和在线凸优化(online learning and online convex optimization)—在线凸优化框架3
  4. ip route 命令详解
  5. 第10章 网络安全(3)_安全套接字层SSL
  6. IOS 7层协议
  7. jq遍历list和object
  8. springboot打包
  9. swagger常用注解
  10. Python-第三方模块requests快速入手