Algorithm
Problem Name: beecrowd | 2759
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2759
Input and Output Character
By Roberto A. Costa Jr, UNIFEI Brazil
Timelimit: 1
Your teacher would like to make a program with the following characteristics:
- Create 3 variables to store a single character;
- Read a character value for the first variable;
- Read a character value for the second variable;
- Read a character value for the third variable;
- Print the letter A, a space, the equals sign, a blank, the character stored in the first variable read in step 2, a comma, a blank, the letter B, a blank, the sign equal to one blank, the character stored in the second variable read in step 3, the letter C, a blank, the equal sign, a blank, the character stored in the third variable read in step 4. No forget to skip line;
- Print the letter A, a space, the equals sign, a blank, the character stored in the first variable read in step 3, a comma, a blank, the letter B, a blank, the sign equal to one blank, the character stored in the second variable read in step 4, the letter C, a blank, the equal sign, a blank, the character stored in the third variable read in step 2. No forget to skip line;
- Print the letter A, a blank, the equals sign, a blank, the character stored in the first variable read in step 4, a comma, a blank, the letter B, a blank, the sign equal to one blank, the character stored in the second variable read in step 2, the letter C, a blank, the equal sign, a blank, the character stored in the third variable read in step 3. No Forget to skip line.
Input
The entry consists of several test files. Each test file has three rows. In the first line has a variable A that stores a character value. The second line has a variable B that stores a character value. The third line has a variable C that stores a character value. As shown in the following input example.
Output
For each file in the entry, you have an output file. The output file has three rows as described in items 5, 6, and 7. As shown in the following output example.
Input Samples | Output Samples |
a b c |
A = a, B = b, C = c A = b, B = c, C = a A = c, B = a, C = b |
0 1 2 |
A = 0, B = 1, C = 2 A = 1, B = 2, C = 0 A = 2, B = 0, C = 1 |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include <stdio.h>
int main(void)
{
char a, b, c;
while (scanf(" %c %c %c", &a, &b, &c) != EOF)
{
printf("A = %c, B = %c, C = %c\n", a, b, c);
printf("A = %c, B = %c, C = %c\n", b, c, a);
printf("A = %c, B = %c, C = %c\n", c, a, b);
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iterator>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<cstdio>
#include<stack>
#include<queue>
#include<math.h>
#include <utility>
#include <sstream>
#include<bitset>
using namespace std;
typedef long long ll;
typedef std::vector < double> vi;
#define PI acos(-1)
#define E 2.718281828459
int main(int argc, char** argv) {
char a,b,c;
cin >>a >> b >> c;
printf("A = %c, B = %c, C = %c\n",a,b,c);
printf("A = %c, B = %c, C = %c\n",b,c,a);
printf("A = %c, B = %c, C = %c\n",c,a,b);
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Java Programming
Code -
Java Programming
import java.util.Scanner;
import java.util.Locale;
public class Main {
public static void main(String[] args) {
Locale.setDefault(new Locale("en", "US"));
Scanner sc = new Scanner(System.in);
char a = sc.next().charAt(0);//2
char b = sc.next().charAt(0);//3
char c = sc.next().charAt(0);//4
/* 05 */System.out.printf("A = %c, B = %c, C = %c\n",a,b,c);
/* 06 */System.out.printf("A = %c, B = %c, C = %c\n",b,c,a);
/* 07 */System.out.printf("A = %c, B = %c, C = %c\n",c,a,b);
sc.close();
}
}
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Javascript Programming
Code -
Javascript Programming
const { readFileSync } = require("fs")
const [A, B, C] = readFileSync("/dev/stdin", "utf8").split("\n")
console.log("A = %s, B = %s, C = %s", A, B, C)
console.log("A = %s, B = %s, C = %s", B, C, A)
console.log("A = %s, B = %s, C = %s", C, A, B)
Copy The Code &
Try With Live Editor
Input
Output
#5 Code Example with Python Programming
Code -
Python Programming
a = str(input())
b = str(input())
c = str(input())
print('A = {}, B = {}, C = {}'.format(a, b, c))
print('A = {}, B = {}, C = {}'.format(b, c, a))
print('A = {}, B = {}, C = {}'.format(c, a, b))
Copy The Code &
Try With Live Editor
Input
Output