编程介的小学生 2017-08-20 16:14 采纳率: 20.5%
浏览 637
已采纳

Deal with C++ Comments

In C++ ,there are two styles of comment, one is a stream of characters enclosed by "/*" and "*/", and the other is a single line beginning with "//". Comments will not be nested as in c++.
Your task is to deal with these comments, which is to capitalize all the letters in a comment and count the number of occurrence of comments.

To simplify your task, you may assume that comments will not appear in constant strings.

Input

The first line speicifies the number of test cases T (T <= 10). Each test case begins with a number L (L <= 10000), the number of lines of the C++ code, following L lines which is the body of the code.

Output

For each test case, output the number occurrence of comments you've found and then the resulting text of your processing. print a line after each test case.

Sample Input

3

1
/*aoao~~
1
/*aoao //aoao /
1
i=0;do/*kaka
/i++ while(i--); // this is an infinite loop

Sample Output

0
/*aoao~~

1
/*AOAO //AOAO */

2
i=0;do/*KAKA*/i++ while(i--); // THIS IS AN INFINITE LOOP

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-09-01 15:54
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?