Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Created February 4, 2014 12:55
Show Gist options
  • Save KT-Yeh/8803101 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8803101 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
void l1 (char line[], char s[][1000])
{
int i,j;
for (i=0; line[i]!='<'; i++) printf("%c",line[i]);
for (i++,j=0; line[i]!='>'; i++,j++) s[2][j] = line[i];
s[2][j] = '\0';
for (i++,j=0; line[i]!='<'; i++,j++) s[3][j] = line[i];
s[3][j] = '\0';
for (i++,j=0; line[i]!='>'; i++,j++) s[4][j] = line[i];
s[4][j] = '\0';
for (i++,j=0; line[i]; i++,j++) s[5][j] = line[i];
s[5][j] = '\0';
printf("%s%s%s%s\n",s[2],s[3],s[4],s[5]);
}
void l2 (char line[], char s[][1000])
{
int i,j;
for (i=0; line[i]!='.'; i++) printf("%c",line[i]);
printf("%s%s%s%s\n",s[4],s[3],s[2],s[5]);
}
int main()
{
// freopen ("input.txt","rt",stdin);
int N;
char line[10000],s[6][1000];
scanf("%d",&N);
getchar();
while (N--){
gets(line);
l1 (line, s);
gets(line);
l2 (line, s);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment