package 去哪儿; public class Chongfu { public  static void chongfu(String s) {    String subletter = "";      String pre = "";     String output="";    boolean isletter = true;      boolean isfirst = true;      int times = 0;//记录每个字串需要重复的次数          int curnum = 0;//记录当前这个字符代表的数字值      for(int i = 0 ; i < s.length() ; i++)    {          if((s.charAt(i) >= 'a' && s.charAt(i) <= 'z') ||(s.charAt(i) >= 'A' && s.charAt(i) <= 'Z'))        {             subletter += s.charAt(i);                 isletter = true;          }else        {             curnum =s.charAt(i) - '0';            if(isletter == false)          {                               times = times * 10 + curnum;                }          else          {                                              if(isfirst == false)               {                      for(int j = 0 ; j < times ; j++)                    {                         output += pre;                      }                      }else                    {                     isfirst = false;                       }                   pre = subletter;                   subletter = "";                       times = curnum;              }             isletter = false;          }      }       for(int j = 0 ; j < times; j++)   {     output += pre;    }   System.out.print(output); } public static void main(String[] args) { String s="a10bc3d1"; chongfu(s); } }
点赞 评论

相关推荐

程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
秋招吐槽大会
点赞 评论 收藏
分享
12-15 12:50
河北工程大学
sta666:我也是这个国际商业化的,三天,一天一面,就通过了,不过我是后端实习生,好好面感觉能过。
点赞 评论 收藏
分享
头像 会员标识
12-16 14:43
浙江大学 Java
投递牛客等公司9个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务