输出格式

输出格式 



Description

张老师是中北大学一位德高望重的老教授,他的学生真可谓是桃李满天下。但随着时间的流逝,他老人家的视力逐渐下降了,阅读起文章来很费劲,尤其是看到一大段文字时经常感到头晕,因此他想让你为他编写一个程序将文章的每一段转化成一句一行的形式,并在每行的前面加上相应的序号,还要在每段的首部都加一排“*”以便他老人家阅读。 

Input

有多段文字,每段文章开头都有两个空格,每段文字不会多余10000字符。每段文字至少包含一句。 

Output

将每段文章中的每句文字分行输出,并在每句前加上相应的序号。每段文字的首句前加上一排“*”号,使最后一个“*”与每段文字的首句的“.”上下对齐。每一段输出后空一行。(如样例输出 )


Example Input

   Do you want to succeed? Stop crazy think about how to make yourself successful.   

   You will print to standard output either the word ``unsolvable''.


Example Output


*************************

1 Do you want to succeed?

2 Stop crazy think about how to make yourself successful.

 

*******************************************************************

1 You will print to standard output either the word ``unsolvable''.

Hint

每句话的末尾以“.”“?”“!”结束,有的句尾“.”“?”“!”后面有空格,而有的“.”“?”“!”后没有空格。注意gets()和scanf()的选择 


#include <string.h>
#include <stdio.h>

int main()
{
    char s[100010];
    while  (gets(s)) 
	{
        int count = 0;
        int pos = 0;
        int len = strlen(s);
        int i, j;
        for (i=0; i<len; ++i)
		 {
            if (s[i]=='.' || s[i]=='!' || s[i]=='?')
			 {
                ++count;
                while (s[pos] == ' ') {
                    ++pos;
                }
                if (count == 1) 
				{
                    for (j=0; j<i+3-pos; ++j)
					 {                   
                        printf("*"); 
                    }
                    printf("\n"); 
                }
                printf("%d ",count); 
                for (j=pos; j<=i; ++j) 
				{
                    printf("%c",s[j]); 
                }
                printf("\n"); 
                pos = i+1;
            }
        }
        printf("\n"); 
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值