Problem C: 2连续相等的数的个数

Problem C: 2连续相等的数的个数

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

题目描述:
已知有N个整数,求每个数连续相等的数的个数。


输入:
第一行有一个正整数N,它的范围是[1..10000]。 第二行有N个正整数,它的范围是[1..100]。


输出:
有多行,每行有两个数,第一个数是数组中的数,第二个是这个数连续的个数。


输入样例1
7
1 1 1 5 2 1 1  
输出样例1
1 3
5 1
2 1
1 2

Sample Input Copy

7
1 1 1 5 2 1 1

Sample Output Copy

1 3
5 1
2 1
1 2

HINT

n=int(input())+1
a=list(map(int,input().split()))
a.append(-1)
cur=a[0]
cnt=1
for i in range(1,n):
  if cur!=a[i]:
    print(cur,cnt)
    cur=a[i]
    cnt=1
  else:
    cnt+=1