BOJ 11718 그대로 출력하기

1 개요[ | ]

BOJ 11718 그대로 출력하기
  • 입력받은 문자를 출력하는 문제1
  • 알고리즘 분류: 출력

2 C++[ | ]

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    while(getline(cin, s)) {
        cout << s << '\n';   
    }
}

3 Go[ | ]

package main
import ( "io"; "os" )
func main() {
	io.Copy(os.Stdout, os.Stdin)
}
package main
import ( "bufio"; "fmt"; "os" )
func main() {
    scanner := bufio.NewScanner(os.Stdin)
    for scanner.Scan() {
    	fmt.Println(scanner.Text())
    }
}

4 Java[ | ]

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()) {
            System.out.println(sc.nextLine());
        }
    }
}

5 node.js[ | ]

console.log(''+require('fs').readFileSync('/dev/stdin'))
console.log(require('fs').readFileSync('/dev/stdin')+'')
console.log(require('fs').readFileSync('/dev/stdin').toString())

6 Perl[ | ]

print<>
print while (<>);

7 PHP[ | ]

<?php
while( !feof(STDIN) ) echo fgets(STDIN);
<?php
while( $line=fgets(STDIN) ) echo $line;
<?php
while( $line=rtrim(fgets(STDIN)) ) echo "$line\n";
<?php
while($line = fgets(STDIN)){
    $line = strtok($line,"\n");
    echo "$line\n";
}

8 Python[ | ]

import sys
for line in sys.stdin:
    print( line, end='' )
import sys
for line in sys.stdin:
    sys.stdout.write(line)

9 R[ | ]

a = readLines("stdin")
cat(a, sep="\n")

10 Ruby[ | ]

puts gets('')
while s=gets
    puts s
end
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}