View Code of Problem 3851

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
char a[29]={'q','w','e','r','t','y','u','i','o','p','[',
'a','s','d','f','g','h','j','k','l',';',
'z','x','c','v','b','n','m',','};
int main() {
	int t;
	char s2[100];
	char s1[100];
	scanf("%d",&t);
	while(t--)
	{
		scanf("%s",s2);
		int len=strlen(s2);
		int i,j,k=0;
		for(i=0;i<len;i++)
		{
			for(j=0;j<29;j++)
			{
				if(s2[i]==a[j])
				{
					s1[k++]=a[j-1];
				}
			}
		}
		for(i=0;i<k;i++)
		{
			printf("%c",s1[i]);
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3851