0
我想读取输入文件并将其转换为单词,然后提供唯一的整数ID。如何拆分字符串并分配唯一的ID
我能够将输入字符串转换为单词,但我很困惑如何为每个单词指定唯一的ID并需要删除重复项。 (如果输入 - 我想去康提两个场合“到”应该得到相同的ID。)
这是我的代码:
Scanner sc = new Scanner(System.in);
System.out.println("enter the word");
String s= sc.nextLine();
String st[] =s.split(" ");
for(int i=0;i<st.length-1 ;i++)
{
System.out.println(st[i]);
}
侧面说明,'我
Maroun