Skip to content

Instantly share code, notes, and snippets.

@amoshyc
Last active August 29, 2015 14:11
Show Gist options
  • Save amoshyc/fcd6fb9d3f88e6b56789 to your computer and use it in GitHub Desktop.
Save amoshyc/fcd6fb9d3f88e6b56789 to your computer and use it in GitHub Desktop.
uva11946.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
int T;
scanf("%d\n", &T);
const char* map = "OIZEASGTBP";
int case_;
for(case_=0; case_ < T; case_++) {
if (case_ != 0)
printf("\n");
char inp[82];
while (fgets(inp, 82, stdin) != NULL) {
int len = strlen(inp);
if (inp[len-1] == '\n') {
inp[len-1] = '\0';
len--;
}
if (len == 0)
break;
int i;
for(i=0; i<len; i++) {
if ('0' <= inp[i] && inp[i] <= '9')
printf("%c", map[inp[i] - '0']);
else
printf("%c", inp[i]);
}
printf("\n");
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment