11635 position

mail@pastecode.io avatar
unknown
plain_text
2 years ago
486 B
3
Indexable
Never
#include <stdio.h>
#include <string.h>

int main(void) {
  int p=0;
  int a[150][100000],len[150]={0};
  for(int i=0;i<150;i++)
    a[i][0]=-1;
  char tmp;
  while(1){
    scanf("%c",&tmp);
    if(tmp=='\n')break;
    a[tmp][len[tmp]]=p;
    len[tmp]++;
    p++;
  }
  for(int i=0;i<150;i++){
    if(a[i][0]!=-1){
      printf("%c: ",i);
      for(int j=0;j<len[i]-1;j++)
        printf("%d ",a[i][j]);
      printf("%d",a[i][len[i]-1]);
      printf("\n");
    }
    
  }
  return 0;
}