Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
536 B
5
Indexable
Never
#include<stdio.h>
#include<string.h>
using namespace std;

char ary[1000000];
char cmd[1000000];
int t,indexs;
char *point;

int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%s %d",ary,&indexs);
		point=&ary[indexs];
		scanf("%s",cmd);
		int len=strlen(cmd);
		for(int i=0;i<len;i++){
			if(cmd[i]=='>'){
				point+=1;
			}
			else if(cmd[i]=='<'){
				point-=1;
			}
			else if(cmd[i]=='+'){
				*point+=1;	
			}
			else if(cmd[i]=='-'){
				*point-=1;
			}
			else if(cmd[i]=='.'){
				putchar(*point);
			}
		}
		printf("\n");
	}
}