Problem:


Score : 200 points

Problem Statement

You have a digit sequence S of length 4. You are wondering which of the following formats S is in:

YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order

MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order

If S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

Print the specified string: YYMM, MMYY, AMBIGUOUS or NA.

Sample Input 1

1905

Sample Output 1

YYMM

May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

Both December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.

Sample Input 3

1700

Sample Output 3

NA

Neither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

s = input()


before = int(s[0:2])
after = int(s[2:4])

before_year = False
after_year = False
before_m = False
after_m = False

if before > 12:
    before_year = True
else: before_m = True

if after > 12:
    after_year = True
else: after_m = True

if before==0 and after==0:
    print('NA')
elif before ==0 and after_m==True:
    print('YYMM')
elif after == 0 and before_m==True:
    print('MMYY')
elif before==0 or after==0:
    print('NA')
elif before_year==True and after_year==True:
    print('NA')
elif before_m==True and after_m==True:
    print('AMBIGUOUS')
elif before_year==True and after_m==True:
    print('YYMM')
elif before_m==True and after_year==True:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
nazo=int(input())
b=nazo%100
a=int(nazo/100)

if 1<=a<=12 and 1<=b<=12:
  print("AMBIGUOUS")
elif a==0 and 1<=b<=12:
  print("YYMM")
elif 1<=a<=12 and b==0:
  print("MMYY")
elif a>12 and 1<=b<=12:
  print("YYMM")
elif 1<=a<=12 and b>12:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
S=input()
if '01'<=S[0:2]<='12':
    MMYY=True
else:
    MMYY=False
if '01'<=S[2:4]<='12':
    YYMM=True
else:
    YYMM=False
if MMYY and YYMM:
    print('AMBIGUOUS')
elif MMYY and not YYMM:
    print('MMYY')
elif not MMYY and YYMM:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()
a=int(s[0:2])
b=int(s[2:4])
if ((a<1 or a>12) and (b<1 or b>12)):
	print("NA")
elif (a>=1 and a<=12) and (b>=1 and b <=12):
	print("AMBIGUOUS")
elif a>=1 and a<=12:
	print("MMYY")
else:
	print("YYMM")

Submission status: Accepted

Solution code:
s = input()
a = int(s[0:2])
b = int(s[2:4])

if 1<= a <= 12 and 1 <= b <= 12 :
    print("AMBIGUOUS")
elif 1 <= a <= 12 and 0 <= b <= 99 :
    print("MMYY")
elif 0 <= a <= 99 and 1 <= b <= 12 :
    print("YYMM")
else : print("NA")

Submission status: Accepted

Solution code:
import datetime as dt
S = input()
pre = int(S[0:2])
aft = int(S[2:4])

# yymm
try:
    dt.date(int(pre), int(aft), 1)
    flg_yymm = 1
except:
    if int(pre) == 0 and int(aft) >= 1 and int(aft) <= 12:
        flg_yymm = 1
    else:
        flg_yymm = 0
# mmyy
try:
    dt.date(int(aft), int(pre), 1)
    flg_mmyy = 1
except:
    if int(aft) == 0 and int(pre) >= 1 and int(pre) <= 12:
        flg_mmyy = 1
    else:
        flg_mmyy = 0

if flg_yymm == 1 and flg_mmyy == 1:
    print("AMBIGUOUS")
elif flg_yymm == 1 and flg_mmyy == 0:
    print("YYMM")
elif flg_yymm == 0 and flg_mmyy == 1:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

if  '01' <= S[:2] <= '12' and '01' <= S[2:] <= '12':
    print('AMBIGUOUS')
elif '01' <= S[:2] <= '12':
    print('MMYY')
elif '01' <= S[2:] <= '12':
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

former = S[0:2]
latter = S[2:4]

is_former_month = False
is_latter_month = False
if 1 <= int(former) <= 12:
    is_former_month = True
if 1 <= int(latter) <= 12:
    is_latter_month = True

if is_former_month and is_latter_month:
    print("AMBIGUOUS")
elif is_former_month:
    print("MMYY")
elif is_latter_month:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
c=input()
a=int(c[:2])
b=int(c[2:])
if a in range(1, 13):
	if b in range(1, 13):
		s="AMBIGUOUS"
	else:
		s="MMYY"
elif b in range(1, 13):
	s="YYMM"
else:
	s="NA"
print(s)

Submission status: Accepted

Solution code:
import re
S = re.split("(..)", input())[1::2]
S[0] = int(S[0])
S[1] = int(S[1])

if 0 < S[0] <= 12:
    if 0 < S[1] <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0 < S[1] <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
a = int(input())
b = a%100
c = a//100
if 0<b and b<13 and 0<c and c<13:
    print('AMBIGUOUS')
elif 0<b and b<13:
    print('YYMM')
elif 0<c and c<13:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys
s = int(input())
a = s //100
b = s % 100
mmyy = 0
yymm = 0

if 1<=a <= 12:
    if 1<=b <= 12:
         yymm = 1
         mmyy = 1
    else:
        mmyy = 1
elif 0 <= a <= 99:
    if 1<=b <= 12:
         yymm = 1

if mmyy == 1 and yymm == 1:
    print("AMBIGUOUS")
elif mmyy == 1:
    print("MMYY")
elif yymm == 1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
mae = int(S[0:2])
ato = int(S[2:4])
mM = 0
aM = 0
if 1<=mae<=12:
    mM = 1
if 1<=ato<=12:
    aM = 1
if mM + aM == 2:
    print('AMBIGUOUS')
elif mM + aM == 0:
    print('NA')
elif mM == 1:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
s = input()

ue = int(s[0]+s[1])
sita = int(s[2]+s[3])

if ue == 0 and sita == 0:
    print('NA')
elif ue == 0 and sita > 0 and sita <= 12:
    print('YYMM')
elif sita == 0 and ue > 0 and ue <= 12:
    print('MMYY')
elif sita > 0 and sita <= 12 and ue > 0 and ue <= 12:
    print('AMBIGUOUS')
elif sita > 0 and sita <= 12 and ue > 12:
    print('YYMM')
elif ue > 0 and ue <= 12 and sita > 12:
    print('MMYY')
elif ue > 12 and sita > 12:
    print('NA')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
ff = S[:2]
bb = S[2:]

if (int(ff) > 12 or int(ff) <= 0) and (int(bb) > 12 or int(bb) <= 0):
	print('NA')
elif (int(ff) <= 12 and int(ff) > 0) and (int(bb) <= 12 and int(bb) > 0):
	print('AMBIGUOUS')
elif (int(ff) > 12 or int(ff) <= 0) and (int(bb) <= 12 and int(bb) > 0):
	print('YYMM')
else:
	print('MMYY')

Submission status: Accepted

Solution code:
S = input()

if 1<= int(S[:2]) <= 12:
    if 1<= int(S[2:4]) <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<= int(S[2:4]) <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S=input()
A=int(S[:2])
B=int(S[2:])

if 1<=A<=12 and 1<=B<=12:
    print("AMBIGUOUS")

elif 1<=A<=12:
    print("MMYY")
elif 1<=B<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
D = input()
a, b = [int(D[:2]), int(D[2:])]
if (a > 12 or a==0) and b != 0 and b <= 12:
  print('YYMM')
elif a != 0 and a <= 12 and (b > 12 or b == 0):
  print('MMYY')
elif a != 0  and a <= 12 and b != 0 and b <= 12:
  print('AMBIGUOUS')
else:
  print('NA')

Submission status: Accepted

Solution code:
input_str = input()
zenhan = int(input_str[:2])
kouhan = int(input_str[2:])

if zenhan > 12:
  if kouhan > 12 :
    print('NA')
  elif kouhan == 0:
    print('NA')
  else:
    print('YYMM')
elif zenhan == 0:
  if kouhan > 12 :
    print('NA')
  elif kouhan == 0:
    print('NA')
  else:
    print('YYMM')
else:
  if kouhan >= 1:
    if kouhan <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    print('MMYY')

Submission status: Accepted

Solution code:
s = input()

s1 = s[0:2]
s2 = s[2:4]

yl = ["{:02d}".format(i) for i in range(100)]
ml = ["{:02d}".format(i+1) for i in range(12)]

if (s1 in yl and s2 in ml) and (s1 in ml and s2 in yl):
    print('AMBIGUOUS')
elif (s1 not in yl or s2 not in ml) and (s1 not in ml or s2 not in yl):
    print('NA')
elif (s1 in yl and s2 in ml) ^ (s2 not in yl and s1 not in ml):
    print('YYMM')
elif (s2 in yl and s1 in ml) ^ (s1 not in yl and s2 not in ml):
    print('MMYY')

Submission status: Accepted

Solution code:
s = input()
f = int(s[:2])
b = int(s[2:])

if (1<= f <= 12 and 1<=b<=12):
	print("AMBIGUOUS")
elif (1<=f<=12 and 13<=b) or (1<=f<=12 and b==0):
	print("MMYY")
elif (13<=f and 1<=b<=12) or (f==0 and 1<=b<=12):
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
a,b,c,d=input()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if 1<=10*a+b<=12 and 1<=10*c+d<=12:
  print("AMBIGUOUS")
elif 1<=10*a+b<=12 and (10*c+d==0 or 10*c+d>=13):
  print("MMYY")
elif (10*a+b==0 or 10*a+b>=13) and 1<=10*c+d<=12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
b1 = False
b2 = False

if s[0] == '1':
    b1 = s[1] <= '2'
elif s[0] == '0':
    b1 = s[1] != '0'

if s[2] == '1':
    b2 = s[3] <= '2'
elif s[2] == '0':
    b2 = s[3] != '0'

if b1:
    print("AMBIGUOUS" if b2 else "MMYY")
else:
    print("YYMM" if b2 else "NA")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

S = input().rstrip()
l = [0]*2
y = S[:2]
m = S[2:]
l[0] = 0 if "01" <= y <= "12" else 1
l[1] = 1 if "01" <= m <= "12" else 0

if l[0] == 0 and l[1] == 1:
  print("AMBIGUOUS")
elif l[0] == 1 and l[1] == 1:
  print("YYMM")
elif l[0] == 0 and l[1] == 0:
  print("MMYY")  
else:
  print("NA")

Submission status: Accepted

Solution code:
S=int(input())
S1=S%100
S2=int(S/100)
if S1<=12 and S1!=0 and S2 <=12 and S2!=0:
    ans='AMBIGUOUS'
elif S1<=12 and S1!=0:
    ans='YYMM'
elif S2 <=12 and S2!=0:
    ans='MMYY'
else:
    ans='NA'
print(ans)

Submission status: Accepted

Solution code:
s = int(input())
h = s//100
l = s%100
# print(h,l)

def check_month(i):
    if i <= 12 and i >= 1:
        return True
    else:
        return False

def check_year(i):
    return True
    # if i != 0:
    #     return True
    # else:
    #     return False

ym = check_year(h) and check_month(l)
my = check_month(h) and check_year(l)

if ym and my:
    print("AMBIGUOUS")
elif ym and not my:
    print("YYMM")
elif not ym and my:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
upper = int(S[:2])
lower = int(S[2:])
if 1 <= upper <= 12:
  if 1 <= lower <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1 <= lower <= 12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
s=list(map(int,list(input())))
#print(s)
first=10*s[0]+s[1]
second=10*s[2]+s[3]
# print(first)
# print(second)

if (13<=first or first ==0) and (13<=second or second ==0):
    print("NA")

elif 1 <= first <= 12 and 1 <= second <= 12:
    print("AMBIGUOUS")

elif 1 <= first <= 12 and (second >= 13 or second==0):
    print("MMYY")
elif 1 <= second <= 12 and (first >= 13 or first==0):
    print("YYMM")

Submission status: Accepted

Solution code:

S=input()

f=int(S[:2])
l=int(S[2:])

if(f==0 and l==0):
	print("NA")
	exit()
if(f==0 and l<=12):
	print("YYMM")
	exit()
if(f<=12 and l==0):
	print("MMYY")
	exit()
if(f==0 and l>12):
	print("NA")
	exit()
if(f>12 and l==0):
	print("NA")
	exit()


if(f>12 and l<=12):#年はありえない
	print("YYMM")
if(f<=12 and l>12):
	print("MMYY")
if(f<=12 and l<=12):
	print("AMBIGUOUS")
if(f>12 and l>12):
	print("NA")

Submission status: Accepted

Solution code:
S=str(input())

a=int(S[0]+S[1])
b=int(S[2]+S[3])



if 1<=a and a<=12:
    if 1<=b and b<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=b and b<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = list(input())
first = int("".join(S[:2]))
last = int("".join(S[2:]))
yymm = False
mmyy = False
if first > 0 and first < 13:
  mmyy = True
if last > 0 and last < 13:
  yymm = True
if yymm and mmyy:
  print("AMBIGUOUS")
elif yymm:
  print("YYMM")
elif mmyy:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
S = input()
if S[:2] == "00" and S[2:] == "00":
    print('NA')
elif S[:2] == "00" and int(S[2:]) > 12:
    print('NA')
elif int(S[:2]) > 12 and S[2:] == "00":
    print('NA')
elif S[:2] == "00" and int(S[2:]) <= 12:
    print('YYMM')
elif int(S[:2]) <= 12 and S[2:] == "00":
    print('MMYY')
elif int(S[:2]) > 12 and int(S[2:]) > 12:
    print('NA')
elif int(S[:2]) <= 12 and int(S[2:]) <= 12:
    print("AMBIGUOUS")
elif int(S[:2]) <= 12:
    print("MMYY")
else:
    print('YYMM')

Submission status: Accepted

Solution code:
letters = list(input())
flg = ['NOSENCE', 'NOSENCE']
if int(''.join(letters[0:2])) >= 1 and int(''.join(letters[0:2])) <= 12:
  flg[0] = 'MM'
if int(''.join(letters[2:4])) >= 1 and int(''.join(letters[2:4])) <= 12:
  flg[1] = 'MM'

if flg[0] == 'MM' and flg[1] == 'MM':
  answer = 'AMBIGUOUS'
elif flg[0] == 'MM':
  answer = 'MMYY'
elif flg[1] == 'MM':
  answer = 'YYMM'
else:
  answer = 'NA'

print(answer)

Submission status: Accepted

Solution code:
s = int(input())

flag1 =  0< s//100 <= 12
flag2 =  0< s%100 <= 12

ans = ""

if flag1 and flag2:
    ans = "AMBIGUOUS"
elif not flag1 and flag2:
    ans = "YYMM"
elif flag1 and not flag2:
    ans = "MMYY"
else:
    ans = "NA"

if s/100==0 and flag2:
    ans = "YYMM"
if s%100==0 and flag1:
    ans = "MMYY"

print(ans)

Submission status: Accepted

Solution code:
s=input().rstrip()
if int(s[0]+s[1])>=1 and int(s[0]+s[1])<=12  and int(s[2]+s[3])>=1 and int(s[2]+s[3])<=12:
    print('AMBIGUOUS')
elif  int(s[0]+s[1])>=1 and int(s[0]+s[1])<=12 and (int(s[2]+s[3])>12 or int(s[2]+s[3])<1):
    print('MMYY')
elif (int(s[0]+s[1])>12 or int(s[0]+s[1])<1) and int(s[2]+s[3])>=1 and int(s[2]+s[3])<=12:
    print('YYMM')
else:
    #print(int(s[0]+s[1]))
    
    #print(int(s[2]))
    print('NA')

Submission status: Accepted

Solution code:
S = int(input())
s12 = S // 100
s34 = S % 100

if s34 >=1 and s34 <= 12:
    yymm = True
else:
    yymm = False

if s12 >=1 and s12 <= 12:
    mmyy = True
else:
    mmyy = False

if yymm and mmyy:
    ans = 'AMBIGUOUS'
elif yymm:
    ans = 'YYMM'
elif mmyy:
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
S = input()

two_f = int(S[:2])
two_b = int(S[2:])

MMYY_flag = 0
YYMM_flag = 0

if 1 <= two_f <= 12:
    MMYY_flag = 1
if 1 <= two_b <= 12:
    YYMM_flag = 1

if MMYY_flag == 1 and YYMM_flag == 1:
    print('AMBIGUOUS')
elif MMYY_flag == 1:
    print('MMYY')
elif YYMM_flag == 1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())
l = s // 100
r = s % 100
def mm(l):
  return 0 < l < 13
if mm(l) and mm(r):
  print("AMBIGUOUS")
elif mm(l):
  print("MMYY")
elif mm(r):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
zenhan = int(s[0:2])
kouhan = int(s[2:])

if zenhan > 12 or zenhan==0:
    if kouhan > 12 or kouhan==0:
        print("NA")
    else:
        print("YYMM")
else:
    if kouhan > 12 or kouhan==0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()

Left  = int(S[0:2])
Right = int(S[2:4])


if   0 < Left <= 12 and 0 < Right <= 12:
	print("AMBIGUOUS")
elif 0 < Left <= 12 and (Right >= 12 or Right == 0):
	print("MMYY")
elif (Left >= 12 or Left == 0) and 0 < Right <= 12:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

S = list(input())
#print(S)
S_int =list(map(int,S))
#print(S_int)
FIRST = S_int[0]*10+S_int[1]
SECOND = S_int[2]*10+S_int[3]

flag1 = 0
flag2 = 0

if FIRST>0 and  FIRST<=12:
    flag1 = 1
if SECOND>0 and SECOND<=12:
    flag2 = 1

if flag1 == 0 and flag2 == 0:
    print("NA")
    
elif flag1 == 0 and flag2 == 1:
    print("YYMM")
elif flag1 == 1 and flag2 == 0:
    print("MMYY")
elif flag1 == 1 and flag2 == 1:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s=list(input())

x=int(''.join(s[0:2]))
y=int(''.join(s[2:4]))

if 1<=x<=12 and 1<=y<=12:
    print("AMBIGUOUS")

elif 0<=x<=99 and 1<=y<=12:
    print("YYMM")

elif 1<=x<=12 and 0<=y<=99:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
l = s[0:2]
r = s[2:]
a = int(l)
b = int(r)
if (0 == a or a>12 )and (b >0 and b <13):
    print('YYMM')
elif (a>0 and a<13) and (b ==0 or b>12):
    print('MMYY')
elif (a>0 and a<13) and (b>0 and b <13):
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# vim: set fileencoding=utf-8:

import sys


def main():
    S = input()
    AA = int(S[:2])
    BB = int(S[2:])

    ay = is_year(AA)
    am = is_month(AA)
    by = is_year(BB)
    bm = is_month(BB)

    ans = "Error"
    if (ay and bm) == True and (by and am) == False:
        ans = "YYMM"
    elif (ay and bm) == False and (by and am) == True:
        ans = "MMYY"
    elif (ay and bm) == True and (by and am) == True:
        ans = "AMBIGUOUS"
    else:
        ans = "NA"

    print(ans)


def is_year(num):
    return True


def is_month(num):
    ret = False
    if 1 <= num <= 12:
        ret = True

    return ret


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
S_bef = int(S[:2])
S_aft = int(S[-2:])

is_bef_yy = False
is_bef_mm = False
is_aft_yy = False
is_aft_mm = False

if S_bef >= 1 and S_bef <= 12:
    is_bef_mm = True
if S_bef >= 0:
    is_bef_yy = True
if S_aft >= 1 and S_aft <= 12:
    is_aft_mm = True
if S_aft >= 0:
    is_aft_yy = True

if is_bef_yy and is_bef_mm and is_aft_yy and is_aft_mm:
    print('AMBIGUOUS')
elif is_bef_yy and is_aft_mm:
    print('YYMM')
elif is_aft_yy and is_bef_mm:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
print("AMBIGUOUS" if int((s[:2]))>0 and int((s[:2]))<13 and int(s[2:])>0 and int(s[2:])<13 else "YYMM" if int(s[2:])<13 and s[2:]!="00" else "MMYY"if int(s[:2])<13 and s[:2]!="00" else "NA")

Submission status: Accepted

Solution code:
S = input()

ans = ''
L, R = int(S[:2]), int(S[2:])
if L >0 and L < 13:
    if R > 0 and R < 13:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if R > 0 and R < 13:
        ans = 'YYMM'
    else:
        ans = 'NA'
        
print("{}".format(ans))

Submission status: Accepted

Solution code:
s = input()

if 0 < (int(s[0] + s[1])) < 13:
    if 0 < (int(s[2] + s[3])) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < (int(s[2] + s[3])) < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
def main():
    s = input()
    a = int(s[:2], 10)
    b = int(s[2:], 10)

    print(solve(a, b))

def solve(a, b):
    x = y = False

    if 1 <= a <= 12:
        x = True
    if 1 <= b <= 12:
        y = True
    
    if x and not y:
        return 'MMYY'
    if not x and y:
        return 'YYMM'
    if x and y:
        return 'AMBIGUOUS'
    return 'NA'

main()

Submission status: Accepted

Solution code:
date = input()

top = int(date[0:2])
bottom = int(date[2:4])

is_top_mm = False
is_top_yy = False
is_bottom_mm = False
is_bottom_yy = False

def print_result():
    global is_top_mm
    global is_top_yy
    global is_bottom_mm
    global is_bottom_yy

    # check NA case
    if not is_top_mm and not is_top_yy:
        print('NA')
        return
    if not is_bottom_mm and not is_bottom_yy:
        print('NA')
        return


    # check YYMM case
    if is_top_yy:
        if is_bottom_mm:
            print('YYMM')
            return
        if is_bottom_yy:
            print('NA')
            return

    # check MMYY case
    if is_bottom_yy:
        if is_top_mm:
            print('MMYY')
            return
        if is_top_yy:
            print('NA')
            return

    print('AMBIGUOUS')


if 1 <= top <= 12:
    is_top_mm = True

if 13 <= top <= 99 or top == 0:
    is_top_yy = True

if 1 <= bottom <= 12:
    is_bottom_mm = True

if 13 <= bottom <= 99 or bottom == 0:
    is_bottom_yy = True

print_result()

Submission status: Accepted

Solution code:
s = list(input())
a = int("".join(s[:2]))
b = int("".join(s[2:]))

a_YY = 0
a_MM = 0
b_YY = 0
b_MM = 0

if a <= 12 and a >= 1:
    a_MM = 1
elif a == 0 or (a > 12 and a <= 99):
    a_YY = 1

if b <= 12 and b >= 1:
    b_MM = 1
elif b == 0 or (b > 12 and b <= 99):
    b_YY = 1

if a_MM == 1 and b_MM == 1:
    print("AMBIGUOUS")
elif a_MM == 1 and b_YY == 1:
    print("MMYY")
elif b_MM == 1 and a_YY == 1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
YM = True
MY = True
former = int(S[0])*10 + int(S[1])
latter = int(S[2])*10 + int(S[3])
if latter == 0 or latter>=13:
    YM = False
if former == 0 or former>=13:
    MY = False
if YM and MY:
    print("AMBIGUOUS")
elif YM == False and MY:
    print("MMYY")
elif MY == False and YM:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
YM = False
MY = False

S = input()
S1 = int(S[:2])
S2 = int(S[2:])
if 0 < S1 < 13:
    MY = True
if 0 < S2 < 13:
    YM = True

if YM and MY:
    print('AMBIGUOUS')
elif YM:
    print('YYMM')
elif MY:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:

a = input()
first = int(a[:2])
second = int(a[2:])

if first <= 12 and 0 < first:
    F = 'M'
else:
    F = 'Y'

if second <= 12 and 0 < second:
    S = 'M'
else:
    S = 'Y'

b = F + S
if b == "YM":
    print("YYMM")
elif b == 'MY':
    print('MMYY')
elif b == 'MM':
    print("AMBIGUOUS")
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
a = int(s[:2])
b = int(s[-2:])
if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif 1 <= b <= 12:
    print('YYMM')
elif 1 <= a <= 12:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:

def isMonth(num):
    return (1 <= num and num <= 12)

if __name__ == '__main__':
    s = input()
    s1 = int(s[:2])
    s2 = int(s[2:])

    if(isMonth(s1)):
        if(isMonth(s2)):
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if(isMonth(s2)):
            print("YYMM")
        else:
            print("NA")

Submission status: Accepted

Solution code:
i = input()
x = int(i[0:2])
y = int(i[2:4])

def isMM(a):
  return 1 <= a and a <= 12

r = isMM(x) * 2 + isMM(y)

print(["NA", "YYMM", "MMYY", "AMBIGUOUS"][r])

Submission status: Accepted

Solution code:
s = str(input())
x = int(s[0:2])
y = int(s[2:])
a = ((1<=x)and(x<=12))
b = ((1<=y)and(y<=12))
if a and b:
  print("AMBIGUOUS")
elif a and (not b):
  print("MMYY")
elif (not a) and b:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
ans = 0
if int(s[0:2]) <= 99 and int(s[0:2]) >= 00 and int(s[2:4]) > 00 and int(s[2:4]) <= 12:
  ans += 1
if int(s[0:2]) <= 12 and int(s[0:2]) > 00 and int(s[2:4]) >= 00 and int(s[2:4]) <= 99:
  ans += 2
if ans == 1:
  print("YYMM")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

Solution code:


def is_month(mm):
    if 1 <= mm <= 12:
        return True
    return False


s = input()
yy, mm = s[:2], s[2:]
yy = int(yy)
mm = int(mm)


if is_month(yy) and is_month(mm):
    print('AMBIGUOUS')
elif is_month(yy):
    print('MMYY')
elif is_month(mm):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

M1 = False
M2 = False
if int(S[0]) <= 1:
    if S[0] == '0' and S[1] != '0':
        M1 = True
    elif S[0] == '1':
        if 0 <= int(S[1]) <= 2:
            M1 = True

if int(S[2]) <= 1:
    if S[2] == '0' and S[3] != '0':
        M2 = True
    elif S[2] == '1':
        if 0 <= int(S[3]) <= 2:
            M2 = True

if M1 and M2:
    print("AMBIGUOUS")
elif M1 and (not M2):
    print("MMYY")
elif (not M1) and M2:
    print("YYMM")
elif (not M1) and (not M2):
    print("NA")

Submission status: Accepted

Solution code:
S = str(input())
pri = ["YYMM","MMYY","AMBIGUOUS","NA"]
nt = ["01","10","11","00"]
Sz = S[0]+S[1]
Sa = S[2]+S[3]
flag = ""
Sz = int(Sz)
Sa = int(Sa)
if Sz > 0 and Sz <= 12:
 flag += "1"
else:
 flag += "0"
if Sa > 0 and Sa <= 12:
 flag += "1"
else:
 flag += "0"
print (pri[nt.index(flag)])

Submission status: Accepted

Solution code:
S = input()
S = list(S)
keta1 = int(S[3])
keta2 = int(S[2])*10
keta3 = int(S[1])
keta4 = int(S[0])*10
keta21 = keta1 + keta2
keta43 = keta3 + keta4

#00<=YY<=99,01<=MM<=12
# YYMM only
if (0 == keta43 or 13 <= keta43) and 1<= keta21 <= 12:
  print('YYMM')
# MMYY only
elif 1 <= keta43 <= 12 and (0 == keta21 or 13 <= keta21):
  print('MMYY')
# YYYY only
elif (0 == keta43 or 13 <= keta43)  and (0 == keta21 or 13 <= keta21):
  print('NA')
else:
  print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = list(input())

p = S[0]+S[1]
q = S[2]+S[3]

p_flag = 0
q_flag = 0

if int(p) == 0 and int(q) == 0:
    print('NA')
elif int(p) == 0:
    if int(q) < 13:
        print('YYMM')
    else:
        print('NA')
elif int(q) == 0:
    if int(p) < 13:
        print('MMYY')
    else:
        print('NA')
else:
    if int(p) > 12:
        p_flag = 1
    if int(q) > 12:
        q_flag = 1

    if p_flag and q_flag:
        print('NA')
    elif p_flag:
        print('YYMM')
    elif q_flag:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
a = int(S[0:2])
b = int(S[2:4])

if a > 12 and 0 < b <= 12 or a == 0 and 0 < b <= 12:
  print('YYMM')
elif a > 12 and b > 12:
  print('NA')
elif a > 12 and b == 0 or a == 0 and b > 12:
  print('NA')
elif 0 < a <= 12 and 0 < b <= 12:
  print('AMBIGUOUS')
elif b > 12 and 0 < a <= 12 or b == 0 and 0 < a <= 12:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
S=str(input())
if int(S[0:2])>0 and int(S[0:2])<13 and int(S[2:4])>0 and int(S[2:4])<13:
  print("AMBIGUOUS")
elif int(S[0:2])>0 and int(S[0:2])<13:
  print("MMYY")
elif int(S[2:4])>0 and int(S[2:4])<13:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = str(input())
a = int(s[0])*10 + int(s[1])
b = int(s[2])*10 + int(s[3])
if (0 < a <= 12 and 0 <= b) and (0 <= a and 0 < b <= 12):
    print("AMBIGUOUS")
elif 0 < a <= 12:
    print("MMYY")
elif 0 < b <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
# coding: utf-8

def is_yy(s):
    return s.isdigit()

def is_mm(s):
    if s[0] == '0':
        return s[1] in '123456789'
    else:
        return s[1] in '012'

def is_yymm(s):
    return is_yy(s[:2]) and is_mm(s[2:])

def is_mmyy(s):
    return is_mm(s[:2]) and is_yy(s[2:])

s = input()
  
if is_yymm(s):
    if is_mmyy(s):
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif is_mmyy(s):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
a = int(s[0 : 2])
b = int(s[2:])

#print(a, b)
if a<=12 and b<=12 and a>0 and b>0:
  print('AMBIGUOUS')

elif a<=12 and (b == 0 or b > 12) and a > 0:
  print("MMYY")
  
elif b<=12 and b > 0 and (a == 0 or a > 12):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
string=str(input())
upper=string[0]+string[1]
lower=string[2]+string[3]
if 0 < int(upper) <13:
  upper_may_mm=1
else:
  upper_may_mm=0

if 0 < int(lower) <13:
  lower_may_mm=1
else:
  lower_may_mm=0


if (lower_may_mm ==1) & (upper_may_mm ==1):
  print("AMBIGUOUS")
elif (lower_may_mm ==0) & (upper_may_mm ==1):
  print("MMYY")
elif (lower_may_mm ==1) & (upper_may_mm ==0):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s=list(input())
ss=s[:2]
sss=s[2:]
x=int("".join(ss))
y=int("".join(sss))

if 1<=x<=12 and 1<=y<=12:
    print("AMBIGUOUS")
elif 1<=x<=12 :
    print("MMYY")
elif 1<=y<=12:
    print("YYMM")
elif x==0 and y==0:
    print("NA")
elif x>=13 and y==0:
    print("NA")
elif x==0 and y>=13:
    print("NA")
elif x>=13 and y>=13:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
s = S // 1000
a = s * 10 + (S - s * 1000) // 100
b = S - a * 100
if(1 <= a and a <= 12) :
  if(1 <= b and b <= 12) :
    print("AMBIGUOUS")
  else :
    print("MMYY")
else :
  if(1 <= b and b <= 12) :
    print("YYMM")
  else :
    print("NA")

Submission status: Accepted

Solution code:
#coding:utf-8

S = input()
Mflag = False
Yflag = False
li = [(i+j) for (i,j) in zip(S[::2],S[1::2])]


if 1 <= int(li[0]) <= 12:
    Mflag = True
else:
    pass

if 1 <= int(li[1]) <= 12:
    Yflag = True
else:
    pass

if Mflag and Yflag:
    print("AMBIGUOUS")
elif Mflag == True and Yflag == False:
    print("MMYY")
elif Mflag == False and Yflag == True:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
    line_input = input()
    head = int(line_input[:2])
    tail = int(line_input[2:])

    YYMM = True
    MMYY = True
    if 1 > head or head > 12:
        MMYY = False

    if 1 > tail or tail > 12:
        YYMM = False

    if not (MMYY or YYMM):
        print("NA")
    elif MMYY and YYMM:
        print("AMBIGUOUS")
    elif MMYY:
        print("MMYY")
    elif YYMM:
        print("YYMM")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
head, tail = int(S[:2]), int(S[2:])
head_mm = 1 <= head <= 12
tail_mm = 1 <= tail <= 12
if head_mm and tail_mm:
    print("AMBIGUOUS")
elif head_mm:
    print("MMYY")
elif tail_mm:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
format = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']
s = input()
ft,bk = s[0:2],s[2:4]
if 1 <= int(ft) <= 12:
    if 1 <= int(bk) <= 12:
        print(format[2])
    else:
        print(format[1])
else:
    if 1 <= int(bk) <= 12:
        print(format[0])
    else:
        print(format[3])