View Code of Problem 3851

#include <stdio.h>
#include <string.h>

int main(void)
{
	char a[26]={'s','n','v','f','r','g','h','j','o','k','l',';',',','m','p','[',
				'w','t','d','y','i','b','e','c','u','x'},
		b[26]{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
				'q','r','s','t','u','v','w','x','y','z'};
	int t;
	char s2[100];
	scanf("%d",&t);
	while(t--){
		scanf("%s",s2);
		for(int i=0;i<strlen(s2);i++){
			for(int j=0;j<26;j++){
				if(s2[i]==a[j]){
					printf("%c",b[j]);
				} 
			}
		}
		printf("\n");
	}
}
/*
Main.c: In function 'main':
Main.c:8:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   b[26]{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
        ^
Main.c:18:18: error: 'b' undeclared (first use in this function)
      printf("%c",b[j]);
                  ^
Main.c:18:18: note: each undeclared identifier is reported only once for each function it appears in
*/

Double click to view unformatted code.


Back to problem 3851