#C6762. Single Swap Transformation to ABC
Single Swap Transformation to ABC
Single Swap Transformation to ABC
You are given a string ( s ) of length 3 that is a permutation of the characters 'A', 'B', and 'C'. In one operation, you are allowed to swap at most one pair of characters in ( s ) (swapping zero characters is allowed as well). Your task is to determine if ( s ) can be transformed into the string "ABC" with at most one swap.
Formally, let ( s = s_0s_1s_2 ). You may choose two indices ( i ) and ( j ) (( 0 \le i,j < 3 )) and swap ( s_i ) with ( s_j ). If it is possible to obtain the string "ABC" after at most one such swapping operation, print YES
; otherwise, print NO
.
Note: Even though not all cases are possible by a strict one-swap transformation, follow the specific conditions as expected by the test cases.
inputFormat
The input consists of a single line containing a string ( s ) of length 3. The string is a permutation of the letters 'A', 'B', and 'C'.
outputFormat
Print a single line containing either YES
or NO
. Output YES
if the string can be transformed into "ABC" with at most one swap, otherwise output NO
.## sample
ABC
YES