Code Formatter

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

Some companies have special requirements for source code format, and it is also good for programmers to keep consistent code style. You are asked to write a simple code formatter for the company to help the poor programmers.

The first thing you need to do is to check whether the source code contains tabs (represented as the escape character '\t'), since different terminals have different ways to display tabs, it's better not to use them, but replace them with spaces.

The code formatter should replace each tab of the source code with 4(four) blank spaces.

Then you need to remove trailing spaces of the source file. Trailing spaces are one or more consecutive whitespaces right before the EOL (end of line, represented as the escape character '\n'), and they usually have no meaning in most programming language, so they can be safely removed.


The input contains multiple test cases!

The first line is an integer N indicating the number of test cases. Each test case is the source which contains not more than 100 lines given to you to format. A single line containing only "##" marks the end of a test case.


For each test case, output a log of the formatter in two lines of the following format:

#A tab(s) replaced #B trailing space(s) removed Where #A is the number of tabs replaced and #B is the number of trailing spaces removed.

Sample Input

include < stdio.h >

int main()
     int a,b;
     while(scanf("%d %d",&a, &b) != EOF) 


Sample Output

4 tab(s) replaced
22 trailing space(s) removed
0 tab(s) replaced
0 trailing space(s) removed


zoj2851 有链接提示的题目请先去链接处提交程序,AC后提交到SDUTOJ中,以便查询存档。

为了使大家理解上面的sample out,对上面的sample input中的程序给出必要的说明
#include < stdio.h >  //<号与s,h与>号之间没有空格
int main()
         int a,b;    //本行前有1个tab
         while(scanf("%d %d",&a, &b) != EOF)   //本行前有1个tab
                  printf("%d\n",a+b);                      //本行前有2个tab,本条语句分号后有14个空格