-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1024.c
More file actions
49 lines (47 loc) · 985 Bytes
/
1024.c
File metadata and controls
49 lines (47 loc) · 985 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
40
41
42
43
44
45
46
47
48
49
/*
author: Alice Francener
problem: 1024 - Encryption
description: https://www.urionlinejudge.com.br/judge/en/problems/view/1024
*/
#include <stdio.h>
int main()
{
int n, i, j, k, m;
char crip[10000], cripIn[10000];
scanf("%d", &n);
getchar();
while (n--)
{
//ler string de caracter
i = 0;
while ((crip[i] = getchar()) != '\n')
{
//1. letras maisculas e minusculas (descolar 3 posicoes para direita)
if ((crip[i] >= 'A' && crip[i] <= 'Z') || (crip[i] >= 'a' && crip[i] <= 'z'))
{
crip[i] = crip[i] + 3;
}
i++;
}
//2. inverter string
k = 0;
for (j = (i - 1); j >= 0; j--)
{
cripIn[k] = crip[j];
k++;
}
//3. metade string (descolar uma posicao para esquerda)
m = i / 2;
for (j = m; j < i; j++)
{
cripIn[j] = cripIn[j] - 1;
}
//imprimir string
for (j = 0; j < i; j++)
{
printf("%c", cripIn[j]);
}
printf("\n");
}
return 0;
}