## [題目連結](https://zerojudge.tw/ShowProblem?problemid=k926) ## 解題想法 * 將字串輸入後逐項做變化,再做比對。 ## 遭遇到的困難 * 由於對字元輸入不熟,在輸入時有許多錯誤。 ## 花費的時間:30分鐘 ## 程式碼 ```cpp=01 #include<cstdio> #include<cstring> int main(){ char s1[100],s2[100]; int n,i,j; scanf("%s%s",s1,s2); scanf("%d",&n); for(i=0;i<n;i++){ char a,b; scanf(" %c %c",&a,&b); for(j=0;j<strlen(s1);j++){ if(s1[j]==a)s1[j]=b; } } int ans=0; for(i=0;i<strlen(s1);i++){ if(s1[i]!=s2[i])ans++; } printf("%d",ans); }
×
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