杭电acm1266

http://acm.hdu.edu.cn/showproblem.php?pid=1266

View Code
 1 #include<stdio.h>
 2 #include<string.h>
 3 int main()
 4 {
 5     int n,i,j;
 6     char s[10000];
 7     scanf("%d",&n);
 8     gets(s);
 9     while(n--)
10     {
11        gets(s);
12        i=strlen(s)-1;
13        while(s[i]=='0')
14           i--;
15        j=i+1;
16        if(s[0]<'0'||s[0]>'9')
17          printf("%c",s[0]);
18        while(s[i]>='0'&&s[i]<='9'&&i>=0)
19          printf("%c",s[i--]);
20        for(;s[j]!='\0';j++)
21          printf("%c",s[j]);
22        printf("\n");
23     }
24 return 0;
25 }

 

posted @ 2013-04-09 20:15  执着追求的IT小小鸟  阅读(113)  评论(0编辑  收藏  举报