acm.lviv.ua problem 1068

 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
#include <stdio.h>
#include <iostream>
using namespace std;
void printBin(char *s) {
for (unsigned int i = 0; i < strlen(s) - 1; i++) {
for (char j = 0; j < 8; j++) {
(char)(s[i] << j) < 0 ? (cout << "L") : (cout << "S");
}
}
}
int main() {
char s[256] = {'\0'};
unsigned int n;
cin >> n;
fgets(s, 255, stdin);
for (unsigned int i = 0; i < n; i++) {
s[0] = '\0';
fgets(s, 255, stdin);
printBin(s);
}
return 0;
}