열렬히.뛰기

inter

école 42 > exam02 > exam02 : part2 > inter

주의점

문자열 s1과 s2가 있다고 치자.

  • s1과 s2의 교집합을 출력 ⇒ while문으로
  • s1에서 겹치는 건 출력하면 안됨 ⇒ for문으로

문제

Assignment name  : inter
Expected files   : inter.c
Allowed functions: write
--------------------------------------------------------------------------------

Write a program that takes two strings and displays, without doubles, the
characters that appear in both strings, in the order they appear in the first
one.

The display will be followed by a \n.

If the number of arguments is not 2, the program displays \n.

Examples:

$>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e
padinto$
$>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e
df6ewg4$
$>./inter "rien" "cette phrase ne cache rien" | cat -e
rien$
$>./inter | cat -e
$