Problem: 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`.

Submission attempts (in order):
s = input()
a = 0

sf = s[:1]  #'sf' is the formar part of the S
sl = s[2:]  #'sl' is the latter part of the S

for i in range(1,9):
  if sf[0] == 0:
    if sf[1] == i:
      a += 1

for j in range(0,2):
  if sf[0] == 1:
      if sf[1] == j:
        a += 1
        
for i in range(1,9):
  if sl[0] == 0:
    if sl[1] == i:
      a += 1

for j in range(0,2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 1
    
if a == 0:
  print('NA')
elif a == 2:
  print('AMBIGUOUS')
elif a == 2:
  print('YYMM')

s = input()
a = 0

sf = s[:1]  #'sf' is the formar part of the S
sl = s[2:]  #'sl' is the latter part of the S

for i in range(1:9):
  if sf[0] == 0:
    if sf[1] == i:
      a += 1
    else:
  else:
for j in range(0:2):
  if sf[0] == 1:
      if sf[1] == j:
        a += 1
      else:
  else:

for i in range(1:9):
  if sl[0] == 0:
    if sl[1] == i:
      a += 1
    else:
  else:
for j in range(0:2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 1
      else:
  else:
    
if a == 0:
  print('NA')
elif a == 2:
  print('AMBIGUOUS')
elif a == 2:
  print('YYMM')

s = input()
a = 0

sf = s[:1]  #'sf' is the formar part of the S
sl = s[2:]  #'sl' is the latter part of the S

for i in range(1,9):
  if sf[0] == 0:
    if sf[1] == i:
      a += 1

for j in range(0,2):
  if sf[0] == 1:
      if sf[1] == j:
        a += 1
        
for i in range(1,9):
  if sl[0] == 0:
    if sl[1] == i:
      a += 2

for j in range(0,2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 2
    
if a == 0:
  print('NA')
elif a == 3:
  print('AMBIGUOUS')
elif a == 1:
  print('MMYY')
elif a == 2:
    print('YYMM')



s = input()

a = s[0:1]
b = s[2:3]

ans = 0

if int(a) <= 12 and int(a) >= 1:
    ans += 2

if int(b) <= 12 and int(b) >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("YYMM")
elif ans == 5:
  print("AMBIGUOUS")


s = input()

a = s[0:1]
b = s[2:3]

ans = 0

if int(a) <= 12 and int(a) >= 1:
    ans += 2

if int(b) <= 12 and int(b) >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")


s = input()
a = 0

sf = s[:1]  #'sf' is the formar part of the S
sl = s[2:]  #'sl' is the latter part of the S

for i in range(1,9):
  if sf[0] == 0:
    if sf[1] == i:
      a += 1

for j in range(0,2):
  if sf[0] == 1:
      if sf[1] == j:
        a += 1
        
for i in range(1,9):
  if sl[0] == 0:
    if sl[1] == i:
      a += 2

for j in range(0,2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 2
    
if a == 0:
  print('NA')
elif a == 3:
  print('AMBIGUOUS')
elif a == 1:
  print('YYMM')
elif a == 2:
    print('MMYY')



s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2
"""
for j in range(0,2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 2
"""
b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')

print(sf[0],sf[1],sl[0],sl[1])


s = input()
a = 0

sf = s[:1]  #'sf' is the formar part of the S
sl = s[2:]  #'sl' is the latter part of the S

for i in range(1,9):
  if sf[0] == 0:
    if sf[1] == i:
      a += 1

for j in range(0,2):
  if sf[0] == 1:
      if sf[1] == j:
        a += 1
        
for i in range(1,9):
  if sl[0] == 0:
    if sl[1] == i:
      a += 2

for j in range(0,2):
  if sl[0] == 1:
      if sl[1] == j:
        a += 2
    
if a == 0:
  print('NA')
elif a == 3:
  print('AMBIGUOUS')
elif a == 2:
  print('YYMM')
elif a == 1:
    print('MMYY')

s = input()

a = s[0:1]
b = s[2:3]

ans = 0

if a <= 12 and a >= 1:
    ans += 2

if b <= 12 and b >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")

s = input()

a = s[:2]
b = s[2:]

ans = 0

if int(a) <= 12 and int(a) >= 1:
    ans += 2

if int(b) <= 12 and int(b) >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("YYMM")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")


s = input()

a = s[:2]
b = s[2:]

ans = 0

if a <= 12 and a >= 1:
    ans += 2

if b <= 12 and b >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("MMYY")
elif ans == 5:
  print("AMBIGUOUS")


s = input()

a = s[:2]
b = s[2:]

ans = 0

if int(a) <= 12 and int(a) >= 1:
    ans += 2

if int(b) <= 12 and int(b) >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("YYMM")
elif ans == 5:
  print("AMBIGUOUS")


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted