# Zerojudge f514. 拼字遊戲 (Spelling) ```cpp= #include <bits/stdc++.h> using namespace std; int main(){ string v,f; cin>>v>>f; int vs=v.size(); int fs=f.size(); int op[fs]; for(int i=0;i<fs;i++){ op[i]=-1; for(int j=0;j<vs;j++){ if(v[j]==f[i]){ op[i]=j+1; v[j]=' '; break; } } } for(int i=0;i<fs;i++){ if(op[i]==-1){ cout<<"X"<<" "; } else{ cout<<op[i]<<" "; } } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up