当前位置:   article > 正文

【蓝桥杯 练习题 解码】_输入hhhellllloo

输入hhhellllloo

【输入】

H3el5o2

【输出】

HHHellllloo

  1. #include<iostream>
  2. #include<string.h>
  3. using namespace std;
  4. int main()
  5. {
  6. char ch[100];
  7. cin >> ch;
  8. int len;
  9. len = strlen(ch);
  10. for (int i = 0; i < len; i++)
  11. {
  12. if (ch[i + 1] > '1' && ch[i + 1] <= '9')
  13. {
  14. for (char j = '1'; j <= ch[i + 1]; j++)
  15. {
  16. cout << ch[i];
  17. }
  18. i++;
  19. }
  20. else
  21. {
  22. cout << ch[i];
  23. }
  24. }
  25. return 0;
  26. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/48132
推荐阅读
相关标签
  

闽ICP备14008679号