#include<bits/stdc++.h>

using namespace std;

int main(){
	int N, Q;
	int CASE=0;
	
	while(cin>>N>>Q&&(N||Q)){
		cout<<"CASE# "<<++CASE<<":\n";
		
		vector<int> stone(N);
	
		for(int i=0;i<N;++i){
			cin>> stone[i];
		}
		
		for(int i=0;i<N;++i){
			cout<<stone[i]; 
		}
		
		sort(stone.begin(),stone.end());
		
		
		while(Q--){
			
			int query;
			cin>>query;
			
			int position=-1;
			for(int i=0;i<N;i++){
				if(stone[i]==query){
					position=i;
					break;
				}
			}
			
			if(position!=-1)
				cout<<query<<" found at "<<position+1<<"\n";
			else
				cout<<query<<" not found "<<"\n";	
		}
	}
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: