-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11058.cpp
More file actions
39 lines (26 loc) · 694 Bytes
/
11058.cpp
File metadata and controls
39 lines (26 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
#include<string.h>
/* Encoding - 11058 */
main(){
int i,j,c=0,r,p;
char k,l,a[101],s[101];
while(scanf("%s",s)!=EOF){
strcpy(a,s);
for(i=0;i<26;i++)
{
scanf("\n%c",&l);
for(j=0;s[j]!='\0';j++)
if(s[j] == 'a'+i)
a[j] = l;
}
scanf("%d",&r);
for(i=1;i<=r;i++)
{
scanf("%d %c %c",&p,&k,&l);
for(j=p;s[j]!='\0';j++)
if(s[j] == k)
a[j] = l;
}
printf("Case #%d: The encoding string is %s.\n\n",++c,a);
}
}