UVaOJ_Problem10361_Automatic Poetry
来源:互联网 发布:淘宝app五星评价 编辑:程序博客网 时间:2024/05/20 21:20
//字符串处理,没什么技术含量,多注意处理下输入时的空格、换行就行了#include<stdio.h>#include<string.h>#include<iostream>using namespace std;int main(){//freopen("TestData.txt","w",stdout);int N,k,BrCnt,BrPos[4],DotFlag,DotPos;char TempCh,Sen1[1000],Sen2[1000];scanf("%d",&N); //scanf读完N之后会把\n留在输入缓冲区 getchar();//吃掉回车 for(int caseNo=1; caseNo<=N; caseNo++){k=0; BrCnt=0;while( (TempCh = getchar())!='\n'){Sen1[k]=TempCh;if(TempCh=='<'||TempCh=='>') BrPos[BrCnt++]=k;k++;}Sen1[k]=0;k=0; DotFlag=0;while((TempCh = getchar())!='\n'){Sen2[k]=TempCh;if((TempCh=='.') && (DotFlag==0)); {DotPos=k; DotFlag=1;}k++;}Sen2[k]=0;for(int ii=0; ii<strlen(Sen1); ii++){if( (Sen1[ii]!='<') && (Sen1[ii]!='>')) printf("%c",Sen1[ii]); }printf("\n");for(int jj=0; jj<strlen(Sen2); jj++){if(Sen2[jj]!='.') printf("%c",Sen2[jj]);else{for(int ll=BrPos[2]+1; ll<BrPos[3]; ll++) printf("%c",Sen1[ll]);for(int ll=BrPos[1]+1; ll<BrPos[2]; ll++) printf("%c",Sen1[ll]);for(int ll=BrPos[0]+1; ll<BrPos[1]; ll++) printf("%c",Sen1[ll]);for(int ll=BrPos[3]+1; ll<strlen(Sen1); ll++) printf("%c",Sen1[ll]);jj=jj+3;}}printf("\n");}return 0;}
0 0
- UVaOJ_Problem10361_Automatic Poetry
- Nonsense Poetry
- Perl Poetry
- Automatic Poetry
- uva_10361_Automatic Poetry
- Automatic Poetry
- Automatic Poetry
- Automatic Poetry
- Automatic Poetry
- Automatic Poetry
- Poetry and the Microphone
- 10361--Automatic Poetry
- 10361 - Automatic Poetry
- 1917Automatic Poetry
- 10361 - Automatic Poetry
- uva 10361 Automatic Poetry
- UVa 10361 - Automatic Poetry
- uva 10361 Automatic Poetry
- 一个GIS专业java实习生的日记——上班第一天
- 欢迎使用CSDN-markdown编辑器
- PAT 结尾
- B - Biorhythms——(中国剩余定理)
- 欢迎来访个人网站——阳光日志
- UVaOJ_Problem10361_Automatic Poetry
- Android RSA加密解密的 工具类的使用
- mysql错误2002的解决办法 ERROR 2002 (HY000) mysql.sock(2)
- 【HDU2602】Bone Collector(01背包入门级)
- javascript
- 今天就开始写写博客了
- Spring与策略模式
- 解决scrollview嵌套listview后,listview的setSelection失效问题
- Mac OS设置环境变量