Created
July 8, 2015 17:14
-
-
Save mob5566/dfa92002a080ce42f011 to your computer and use it in GitHub Desktop.
10361 - Automatic Poetry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tittle: 10361 - Automatic Poetry | |
* Author: Cheng-Shih, Wong | |
* Date: 2015/07/09 | |
*/ | |
// include files | |
#include <bits/stdc++.h> | |
using namespace std; | |
// definitions | |
#define FOR(i,a,b) for( int i=(a),_n=(b); i<=_n; ++i ) | |
#define clr(x,v) memset( x, v, sizeof(x) ) | |
#define N 205 | |
// declarations | |
int n; | |
char s[6][N]; | |
char buf[N]; | |
// functions | |
// main function | |
int main( void ) | |
{ | |
char *cptr; | |
int cnt; | |
// input | |
scanf( "%d", &n ); | |
gets(buf); | |
while( n-- ) { | |
clr( s, 0 ); | |
gets(buf); | |
cnt = 1; | |
cptr = s[1]; | |
FOR( i, 0, strlen(buf)-1 ) { | |
if( buf[i]=='<' || buf[i]=='>' ) | |
cptr = s[++cnt]; | |
else | |
*(cptr++) = buf[i]; | |
} | |
gets(buf); | |
sscanf( buf, "%[^.]", s[0] ); | |
// output | |
FOR( i, 1, 5 ) printf( "%s", s[i] ); | |
putchar('\n'); | |
printf( "%s%s%s%s%s\n", | |
s[0], s[4], s[3], s[2], s[5] ); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment